Hi
In my React-admin application, I have configured the Auth0Provider to obtain a token with an organization ID at the beginning. Here’s the current setup:
return <Auth0Provider
domain={domain}
clientId={clientId}
redirectUri={redirectUri}
organization={orgId}
audience={audience}
scope={scope}
cacheLocation="memory"
useRefreshTokens={true} >
<App />
</Auth0Provider>
My goal is to obtain user tokens for multiple organizations (which has different scopes) and store them in a map so that I can use the appropriate token for each API call based on the organization. Unfortunately, when using getAccessTokenSilently
, I don’t have access to the specific org_id
required for each organization’s token, cause this is managed and called by react admin authProvider.
So this won’t help me:
token = await getAccessTokenSilently({
organization: <<different_org_id>>,
ignoreCache: true,
});
I’ve considered calling the authorize method on my backend (NodeJS) using the auth0-js npm package with WebAuth, but I’m not entirely certain if this is the correct approach.
Do you have any suggestions for a clean and efficient way to obtain multiple user tokens for different organization IDs in this scenario?