Get the token bearer with the JWT module after log in rest method

Created on 30 March 2018, about 6 years ago
Updated 1 April 2024, 3 months ago

Problem/Motivation

After enabling the JWT module. and following Using JSON Web Tokens (JWT) to Authenticate Requests to REST Resources in Drupal 8 on how to use it, it is working.

I know I can access the user JWT token by visiting /jwt/token. My problem is when I try to log in via web services. It returns me the following.

{
    "current_user": {
        "uid": "4",
        "name": "cravushedal"
    },
    "csrf_token": "OlTb7fak5ZS-r1BRiGtBh4IWLm_Z7F1xMpY3KYTGkrU",
    "logout_token": "5DiupHgr9iDxIDVmhHTI3PMX2-Shd6sjuN8hNHrHv7E"
}
 

There isn't any JWT token. What I have to do to get the bearer token?

==

essentially duplicate issue with slightly variant questions:
#3038004: How to get the jwt token.

Proposed resolution

Add JWT token to the returned information from user.login.http route

Remaining tasks

None

User interface changes

New checkbox on admin/config/system/jwt to enable/disable this functionality.

API changes

New event subscriber to add the info to the response
New form alter to add the config to the existing JWT form

Data model changes

None

Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇪🇨Ecuador josueValRob

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024