React-Native JWT Issues

  • Which SDK this is regarding: react-native-auth0
  • SDK Version: 2.1.0
  • Platform Version: React Native 0.64.1
  • Code Snippets/Error Messages/Supporting Details/Screenshots:

Hello,
I am building a software which has two platforms, one being a VueJS website accessing a NodeJS API, and the other being a React-Native app accessing the same NodeJS API. Both platforms utilize the Universal Login page to authenticate users into the application. For communication with the API, we take the access token from the website (as retrieved by this.$auth.getTokenSilently()) and verify it on the API.

My problem comes when trying to replicate this process in React-Native. The react-native-auth0 package does not have the same .getTokenSilently() method. Since that method isn’t available, I’ve been trying to manually get the same access token but I can’t seem to get the same token as retrieved through the method. The tokens I can get fail the validation because the audience of the token shows as my clientId as passed to the auth0 object constructor instead of the audience value I’m passing as well.

Any help would be greatly appreciated!

image

image

Omitting the clientId parameter to the .authorize() method gave me the correct token.

1 Like

Thanks for sharing that with the rest of community!