question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

await authorize(config) never returns

See original GitHub issue

Hi all, I tried to use the library to auth with my google youtube account, I like to query my youtube videos after login and getting access token from the returned userInfo fo authorize() function, but the result is:

  1. My app asked to select email,
  2. After I selected email, it showed the google home page with my email icon on the right corner.
  3. the function call const result = await authorize(config); never returned
  4. I have nowhere to get my access token since nothing returned.

My code is as following, so where did I do wrong?

Thanks

`

     const config = {

         issuer: 'https://accounts.google.com',

         clientId: 'xxx29l52.apps.googleusercontent.com',//it is not my real clientId, but used my real clientId for testing

         redirectUrl: 'com.googleusercontent.apps.xxx29l52:/oauth2redirect',

         scopes: ['https://www.googleapis.com/auth/youtube.readonly']

       };

       console.log("auth config: ",config);

      try {

           const result = await authorize(config);

           console.log("auth result: ",result);

       } catch (error) {

         console.log("auth error: ", error);

       }

`


Environment

System: OS: macOS 10.14.6 CPU: (8) x64 Intel® Core™ i7-7820HQ CPU @ 2.90GHz Memory: 300.06 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 11.4.0 - /usr/local/bin/node npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0 Android SDK: API Levels: 23, 25, 26, 27, 28 Build Tools: 27.0.3, 28.0.2, 28.0.3 System Images: android-22 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom IDEs: Android Studio: 3.1 AI-173.4907809 Xcode: 11.1/11A1027 - /usr/bin/xcodebuild npmPackages: react: ^16.8.6 => 16.8.6 react-native: ^0.60.0 => 0.60.0 npmGlobalPackages: react-native-asset: 2.0.0 react-native-cli: 2.0.1 react-native-cn-richtext-editor: 1.0.33 react-native-git-upgrade: 0.2.7

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
oguenneccommented, Dec 12, 2019

@here I’ve just had the same issue with react-native-app-auth@4.4.0 on Android only (iOS was fine).

The configuration used to work for a long time and suddenly on a recent build it started to fail systematically.

I could solve the issue by:

  • creating another redirectUri in Azure with a full domain namecom.domain.application😕/oauth2/authorize” instead of just “application://oauth2/authorize” name like it used to be, like this:

image

  • configuring this redirectUri as a redirectUrl in react-native-app-auth config object like this: config = { issuer: ‘https://login.microsoftonline.com/xxxxxxxxxxxxxxxxxxxxx’, clientId: ‘xxxxxxxxxxxxxxxxxxxxxxxxxx’, redirectUrl: ‘com.domain.application😕/oauth2/authorize’,
    additionalParameters: {…}
    }; and adding this in android/app/build.grade defaultConfig { … manifestPlaceholders = [ appAuthRedirectScheme: ‘com.domain.application’ ] }
0reactions
ptc-wguocommented, Feb 14, 2020

Issue is still found by following the naming convention of the redirect url (i.e. com.domain.application://oauth2/authorize)

    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-app-auth": "5.0.0",
"com.domain.application://oauth2/authorize" as redirect URL as registered in Azure portal
"com.domain.application" as appAuthRedirectScheme in build.gradle
Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able to return the value while using async function in nodejs
You are await ing jwtClient.authorize but not doing anything with the return value. Your return statement is inside the scope of the callback ......
Read more >
Authorization Callback Never Returns. C# - Windows
The problem is that the authorization return callback never gets called (I confirmed this via a logging function). My program awaits this ...
Read more >
react-native-app-auth - Formidable Labs
authorize. This is the main function to use for authentication. Invoking this function will do the whole login flow and returns the access...
Read more >
Top 5 react-native-app-auth Code Examples - Snyk
refreshToken && expiration < nowSeconds) { return refresh(config, ... async () => { try { const authResult = await onlyAuthorize(config); this.
Read more >
Console app trying to JWT authorize in the sandbox and ...
Authorize () call, but the .Wait just sits and never returns. var rc = new RestClient ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found