'Drupal Auth0 retrieving access token to make external API calls
We have a Drupal project which is integrated with Auth0 using this module https://www.drupal.org/project/auth0
Authentication works as expected and everything is cool so far.
There is one React application which is embedded into Drupal, at the moment this application consumes data from Drupal db using JSON API. (No authentication needed as it is in the Drupal context)
But we have a need to show some data in this React application using our own external API which is secured with Auth0.
In order to call the external API, an access token is required from Drupal authenticated user session.
Not sure how to retrieve this access token from Drupal context and pass to react application so that API request has this as Bearer token.
Note: Do not have luxury of separating this react application from Drupal, because it is just one part (a page) of the big application under same domain.
Application flow
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

