Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth0. getTokenSilently() functionality (update cached user profile silently) #979

Open
6 tasks done
XelNizar opened this issue Sep 24, 2024 · 2 comments
Open
6 tasks done
Labels
bug This points to a verified bug in the code

Comments

@XelNizar
Copy link

Checklist

Description

Is there is any way to do the same thing that getTokenSilently does?
in my case i want to update the userProfile cache in auth0 after any change to my custom database, but that FetchUserScript happens only after an actual authorization process. so in my case i want to be able to hit the authorize endpoint silently without letting the user do any interaction.
Doing a forceRefresh didnt fix the problem

Reproduction

  1. logged in user
  2. update user info in custom DB
  3. forceRefresh credentials
  4. will still have old user data unless you logout + log in back again

Additional context

No response

react-native-auth0 version

3.2.1

React Native version

0.74.5

Expo version

No response

Platform

iOS

Platform version(s)

17

@XelNizar XelNizar added the bug This points to a verified bug in the code label Sep 24, 2024
@MarkintoshZ
Copy link

Hi, I'm also experiencing the same issue. Would really appreciate any updates on this.

@XelNizar
Copy link
Author

XelNizar commented Dec 12, 2024

@MarkintoshZ
I have found a workaround for this:

  1. created an action in auth0 where i check if its a refresh token event using this check:
    if (event.transaction?.protocol === "oauth2-refresh-token")
  2. if so i requested an M2M token where i can call my backend service to receive the user info!
  3. update the app/user metadata (depends on the data you want to update) inside the action itself:
    api.user.setAppMetadata("custom_data",updatedUserData.custom_data);
  4. call the getCredentials method with the 4th parameter as true (for forceRefresh the token):
    this.auth0.credentialsManager.getCredentials(undefined, undefined, undefined, true);

this worked for me, i hope this will be helpful for you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This points to a verified bug in the code
Projects
None yet
Development

No branches or pull requests

2 participants