documenting how to acquire and use the JWT's

Created on 15 November 2021, over 2 years ago
Updated 26 March 2023, over 1 year ago

Problem/Motivation

  • I found this module hard to use at first.
  • I had to Google how to acquire the JWT and how to use it with the JSON:API module.
  • I still didn't know how to use the token until I read through the source code for this module.

Steps to reproduce

Proposed resolution

Once people configure their RS256 or HMAC tokens and keys...

  • You should tell people how to acquire the JWT with a HTTP(S) GET request,
    • regardless of how they make their HTTP(S) GET requests (AJAX, the Axios JavaScript library, curl, NodeJS https, etc.)
  1. Pick a Drupal user with editing permissions on your Drupal website.
  2. Make a Base64 encoded string from the string "<username>:<password>"
  3. Set the GET url to "<URL path to your Drupal site>" + "/jwt/token?_format=json"
  4. The request HTTP(S) headers should include "Content-Type: application/json", and "Authorization: Basic " + <the Base64 string from step 2>
  5. You will receive a JSON string that you can convert or parse into a JavaScript object
  6. The "token" key in the new JavaScript object will refer to your JWT

EDIT:

I apologize. The following information is in the "README.md" file for the module

You should also tell people how to use the token and make Drupal use it for authentication

  • Your PATCH, POST, or whatever HTTP(S) requests to the jsonapi should include "Authorization" headers again
  • This time, the values should be "Bearer <JWT string>"

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Fixed

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States rogman_lebnh

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

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