FormidableLabs / FormidableLabs/react-native-app-auth

App crashes on Android when trying to authorize or redirect to provider login screen: state cannot be null or empty

Open
#866 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.3k
Forks
473
PR merge metrics
No merged PRs in 30d

Description

## Issue

Crash when logging into the application the first time, the other times it works normally. When the token expires and logout is called, the app also gives an error.

> Note: Note: We are using react-native-config for environment variables and login with WSO2

The following error is returned:
```
java.lang.RuntimeException: Unable to resume activity {com.apptort/net.openid.appauth.AuthorizationManagementActivity}: java.lang.NullPointerException: state cannot be null or empty

java.lang.RuntimeException: Unable to resume activity {com.apptort/net.openid.appauth.AuthorizationManagementActivity}: java.lang.NullPointerException: state cannot be null or empty
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4975)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5008)
at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:54)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8252)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:559)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: java.lang.NullPointerException: state cannot be null or empty
at net.openid.appauth.w.f(Unknown Source:9)
at net.openid.appauth.w.d(Unknown Source:0)
at net.openid.appauth.s$b.d(Unknown Source:2)
at net.openid.appauth.s$b.b(Unknown Source:6)
at net.openid.appauth.g.b(Unknown Source:31)
at net.openid.appauth.AuthorizationManagementActivity.e(Unknown Source:23)
at net.openid.appauth.AuthorizationManagementActivity.h(Unknown Source:8)
at net.openid.appauth.AuthorizationManagementActivity.onResume(Unknown Source:26)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1565)
at android.app.Activity.performResume(Activity.java:8668)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4965)
... 13 more
```

### AndroidManifest.xml
```















```

### .env
```
ISSUER = "https://url/oauth2/oidcdiscovery"
CLIENTID = "_secret_"
CLIENTSECRET = "_secret_"
REDIRECTURL = "com.apptort.auth://TortList"
POSTLOGOUTREDIRECTURL = "com.apptort.auth://Welcome"
```

### config
```
const config = {
issuer: Config.ISSUER,
clientId: Config.CLIENTID,
clientSecret: Config.CLIENTSECRET,
redirectUrl: Config.REDIRECTURL,
scopes: ['openid', 'profile'],
dangerouslyAllowInsecureHttpRequests: true,
};
```

---

## Environment

* **Your Identity Provider**: `IdentityServer 4`
* **Platform that you're experiencing the issue on**: `Android`
* **Are you using Expo?:** `No`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.