question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JWT Authentication Support does not work

See original GitHub issue
Q A
Issue Type Issue
Admin Version v0.6.3
Solution Downgrade to v0.6.2
Local Machine OS Ubuntu 18.04 (but shouldn’t be relevant in this case)

Description

Hello!

I have detected a problem with version 0.6.3 related to JWT Authentication.

When you login correctly and the process of loading all entities is done to map the fields, the Authorization: Bearer [token] header is not sent and generates an error 401 Invalid JWT Token.

Failed to load resource: the server responded to a status of 401

In other calls if it is sent, for example, in the call Request Method: OPTIONS.

I validated the JWT token in https://jwt.io/ in case there was an error, but it is a valid token. I used token in Swagger and it has worked correctly.

The solution I have found is to downgrade to v0.6.2.

package.json file

{
    "name": "admin-component",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
        "@api-platform/admin": "0.6.3",
        "react": "^16.8.6",
        "react-dom": "^16.8.6",
        "react-scripts": "3.0.1"
    },
    "devDependencies": {
        "dotenv-cli": "^2.0.0"
    },
    "scripts": {
        "start": "react-scripts start",
        "build:pro": "react-scripts build",
        "build:dev": "dotenv -e .env.development.local react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
    },
    "eslintConfig": {
        "extends": "react-app"
    },
    "browserslist": {
        "production": [
            ">0.2%",
            "not dead",
            "not op_mini all"
        ],
        "development": [
            "last 1 chrome version",
            "last 1 firefox version",
            "last 1 safari version"
        ]
    }
}

If you need more information, ask me.

Grettings @jjpeleato.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

16reactions
dunglascommented, Jun 27, 2019

FYI, we’re working with @marmelab on a brand new version of API Platform Admin. It is almost ready, and will improve a lot the authentication part.

6reactions
tienvxcommented, Oct 9, 2019

Guys! please test again with version 1.0.1

A few notes:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting JWT validation - Google Cloud
Troubleshooting JWT validation · Make sure the JWT contains valid JSON. · Check that the JWT header has the "alg" field and is...
Read more >
Troubleshooting JWT authentication - RingCentral Developers
A JWT is not itself a way to authenticate to the API. Instead, JWT credentials are used to create access tokens. Only access...
Read more >
Troubleshooting issues with HTTP API JWT authorizers
The following provides troubleshooting advice for errors and issues that you might encounter when using JSON Web Token (JWT) authorizers with HTTP APIs....
Read more >
JWT Authentication not working when trying to access a page ...
JWT Authentication not working when trying to access a page directly with valid token; will work when starting at login. React/Node/Express.
Read more >
JWT authentication: Best practices and when to use it
JSON Web Tokens (JWT) is a JSON-encoded representation of a claim or claims that can be transferred between two parties. Though it's a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found