Hello,
I have successfully implemented the auth0 biometric flow with Webauthn and token rotation using the react-native-auth0.
Currently I use the provider for authorize user to connect. After that I would like to use the getCredentials method outside a react component.
I use this code in my middleware:
const baseQuery = fetchBaseQuery({
timeout: 12000,
prepareHeaders: async headers => {
const userAgent = UserAgent.getUserAgent();
const credentials = await auth0Instance.credentialsManager.getCredentials(
AUTH0_SCOPE,
AUTH0_TOKEN_MIN_TLL,
);
if (credentials.accessToken) {
headers.set('Authorization', `Bearer ${credentials.accessToken}`);
}
headers.set('Accept', 'application/json');
headers.set('User-Agent', userAgent);
return headers;
},
});
The problem is that auth0Instance is not the instance created by the Auth0Provider. Is there any solution to use the function getCredentials
use by the provider outside a react component ? Or should I consider another strategy to refresh the token, if so waht could be this strategy ?
I use the version 4 SDK