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.

`handleAuthorize()` doesent work on targetSdk 30

See original GitHub issue

Issue

I needed to upgrade my targetSdk to 30 so i can add the app to google play, but for some reason the authentication stops working, when i call handleAuthorize() it doesn’t work , it throws Error: Error not specified.


Environment

  • Your Identity Provider: IdentityServer 4
  • Platform that you’re experiencing the issue on: iOS / Android / both
  • Are you using Expo? No

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
andrejhristovskicommented, Nov 11, 2021

In android/app/build.gradle add implementation 'net.openid:appauth:0.8.1'

dependencies {
    //noinspection GradleDynamicVersion
    implementation 'com.facebook.react:react-native:+' 
    implementation 'net.openid:appauth:0.8.1' // add this line
    implementation 'androidx.browser:browser:1.2.0'
}

Also, i changed gradle version in android/build.gradle to 4.0.1

buildscript {
 dependencies {
        classpath("com.android.tools.build:gradle:4.0.1")  // modify this line
        classpath ('com.google.gms:google-services:4.3.3')
    }
}

This worked for me, hope it helps you

2reactions
mrbrentkellycommented, Oct 22, 2021

~Experiencing a similar issue after updating to React Native 0.65.1 and Android SDK 30. When calling authorize from react-native-app-auth (v5.1.1) the following error is returned…~

{"code": "browser_not_found", "message": "Error not specified.", "nativeStackAndroid": {}, "userInfo": {}}

~Going to try updating to the latest version of react-native-app-auth to see if that helps any~ 👍

Update after upgrading to v6.4.0

So in version 5.1.1 on RN65.1 and Android 30 I would just get an immediate failure when calling authorize(), but version 6.4.0 is slightly better…

I now get redirected to chrome when calling authorize() to an Okta page (we using Amazon Cognito and Okta), I can enter a username and password, but after clicking login on Okta I get redirected back to the app with the following error…

{"code": "token_exchange_failed", "message": "Invalid ID Token", "nativeStackAndroid": {
"0": {"class": "net.openid.appauth.IdToken", "file": "IdToken.java", "lineNumber": 202, "methodName": "validate"}, 
"1": {"class": "net.openid.appauth.AuthorizationService$TokenRequestTask", "file": "AuthorizationService.java", "lineNumber": 698, "methodName": "onPostExecute"}, 
"2": {"class": "net.openid.appauth.AuthorizationService$TokenRequestTask", "file": "AuthorizationService.java", "lineNumber": 564, "methodName": "onPostExecute"}, 
"3": {"class": "android.os.AsyncTask", "file": "AsyncTask.java", "lineNumber": 771, "methodName": "finish"}, 
"4": {"class": "android.os.AsyncTask", "file": "AsyncTask.java", "lineNumber": 199, "methodName": "access$900"}, 
"5": {"class": "android.os.AsyncTask$InternalHandler", "file": "AsyncTask.java", "lineNumber": 788, "methodName": "handleMessage"}, 
"6": {"class": "android.os.Handler", "file": "Handler.java", "lineNumber": 106, "methodName": "dispatchMessage"}, 
"7": {"class": "android.os.Looper", "file": "Looper.java", "lineNumber": 223, "methodName": "loop"},
"8": {"class": "android.app.ActivityThread", "file": "ActivityThread.java", "lineNumber": 7656, "methodName": "main"}, 
"9": {"class": "java.lang.reflect.Method", "file": "Method.java", "lineNumber": -2, "methodName": "invoke"}}, "userInfo": {}},
"10": {"class": "com.android.internal.os.RuntimeInit$MethodAndArgsCaller", "file": "RuntimeInit.java", "lineNumber": 592, "methodName": "run"}, 
"11": {"class": "com.android.internal.os.ZygoteInit", "file": "ZygoteInit.java", "lineNumber": 947, "methodName": "main"}

If I initiate the authorize flow right after then it’s successful (because it doesn’t need to go through Okta again as its just been authorized).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Permissions updates in Android 11 - Android Developers
Starting in Android 11, whenever your app requests a permission related to location, microphone, or camera, the user-facing permissions dialog contains an ...
Read more >
My Android app is not working properly once I set targetSDK ...
So I was updating my app from targeting API 29 to API 30, and some functions broke. How do I figure out the...
Read more >
Microsoft identity platform and OAuth 2.0 authorization code flow
The target resource is invalid because it doesn't exist, Azure AD can't find it, or it's not correctly configured. This code indicates the ......
Read more >
Error Messages | Maps JavaScript API - Google Developers
Checking Errors in Your Browser; Handling unsupported browsers; If your code still isn't working. This page describes the error messages that can be ......
Read more >
Build on Android: Reader SDK - Square Developer
You are using the Android Gradle Plugin version 3.0.0 or later. The Reader SDK might work with 2.3.0 or later, but stability is...
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