getCredentials returns undefined

Hello i’m building react-native-expo application using this version "react-native": "0.69.6" together with "react-native-auth0": "2.15.0". When i try to authorize users and executing getCredentials right after that i receive undefined how ever is working without problem for iOS and i’m getting really confused. I have check both formats for callback urls

iOS: {IOS_BUNDLE_IDENTIFIER}://dev-bsopdsq7aohmrn6n.us.auth0.com/ios/{IOS_BUNDLE_IDENTIFIER}/callback

android: {ANDROID_PACKAGE}://dev-bsopdsq7aohmrn6n.us.auth0.com/android/{ANDROID_PACKAGE}/callback

and in my case IOS_BUNDLE_IDENTIFIER match ANDROID_PACKAGE so they looks the same but i really have no clue why i’m not able to authorize successfully users on android. Any help is much welcome also i can provide more information if that is going to help as well

Hey there @AndonMitev welcome to the community!

Are users seemingly authorized? That is, are you being redirected to the callback successfully?

While I can’t speak to your app/code specifically I did just test this in our expo sample related this everything seems to be functioning as expected. Perhaps you could give the sample app a go and compare results?

Keep us posted!

Hey @tyf , I just tested with example repo and still getting undefined for credentials call

App json has:

  "plugins": [
      [
          "react-native-auth0",
          {
              "domain": "{MY_DOMAIN}"
          }
      ]
    ],

Also there is a file named auth0-configuration.js who includes:

const config = {
  clientId: 'MzkKF5CYh4fwkXmsNfQqP18NWl9eehAg',
  domain: '{MY_DOMAIN}',
};

export default config;

and inside Auth0 Application Details i have callback and logout urls who looks like this:

com.auth0samples://{MY_DOMAIN}/ios/com.auth0samples/callback,
com.auth0samples://{MY_DOMAIN}/android/com.auth0samples/callback

but get credentials keep throw undefined :frowning: also testing on simulator with android studio Pixel 4 API 30 idk if thats matter

Ok new updates, for some reason when i click first time nothing happen and if i leave the application for 3-4 mins request is made after that, on second attempt to login happens immediately i hope this to be because i use Android Emulator

Still can’t find a way to resolve it on android :frowning: any ideas guys i can provide more information if above one which is shared is not enough, latest update is that credentials are coming but with super delay like few minutes, any idea what might be the cause for this issue. Here are some metrics:

console.log('before authroize', Math.floor(Date.now() / 1000));
await authorize();
 console.log('after authroize', Math.floor(Date.now() / 1000));
const creds = await getCredentials();
console.log('creds', Math.floor(Date.now() / 1000));
accessToken = creds.accessToken;
 LOG  before authroize 1670333618
 LOG  after authroize 1670333619
 LOG  creds 1670333619

Hey there @AndonMitev sorry for the delayed response!

I am unable to reproduce what you are seeing when testing with the emulator (pixel 4 API 30) as well as a physical device (pixel 5a API 33). Have you by any chance seen this from another community member?

1 Like

@tyf Hey bro, somehow get resolved on physical is fine idk, i have another issue, when i’m in the application and user is loggin in, there is a modal Open with and is displaying the application, but user is already in this application any idea how to prevent this Open with modal. Also in this Open with modal, application icon is showed 2 times

1 Like