Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Network calls tagged as unauthorised when resuming app #8

Open
natebakescakes opened this issue Oct 9, 2020 · 0 comments
Open

Network calls tagged as unauthorised when resuming app #8

natebakescakes opened this issue Oct 9, 2020 · 0 comments

Comments

@natebakescakes
Copy link
Contributor

Description

When restoring our app from a paused state, it is intermittently unable to make network calls. We are unsure why the underlying SQLite implementation for the cookie store sometimes throws GDNotAuthorizedErrorBridge.

Setup

  • React Native 0.63.1
  • Blackberry Dynamics SDK for Android: 7.1
  • targetSdkVersion 29
  • Android 11

Steps to reproduce

  1. Launch App
  2. Complete Blackberry registration process
  3. Go into Android multitasking view
  4. Kill App
  5. Launch App again and input blackberry password/authenticate via fingerprint
  6. Make network call

Expected

Network calls should be authorized

Actual

2020-10-09 18:02:43.941 27792-28257/com.example E/unknown:RNReactNativeBbdNetworkingModule: Failed to send url request: https://example.com/api/v1/login
    java.lang.NoClassDefFoundError: com.blackberry.security.mtd.mhbbt.yps
        at com.blackberry.security.mtd.mhbbt.yps.odwpg(Unknown Source:0)
        at com.blackberry.security.mtd.mhbbt.hgi.createCookieStore(SourceFile:202)
        at com.good.gd.apache.http.impl.client.AbstractHttpClient.getCookieStore(SourceFile:351)
        at com.blackberry.bbd.reactnative.networking.RNReactNativeBbdNetworkingModule.executeRequest(RNReactNativeBbdNetworkingModule.java:781)
        at com.blackberry.bbd.reactnative.networking.RNReactNativeBbdNetworkingModule.lambda$sendRequest$0$RNReactNativeBbdNetworkingModule(RNReactNativeBbdNetworkingModule.java:691)
        at com.blackberry.bbd.reactnative.networking.-$$Lambda$RNReactNativeBbdNetworkingModule$OuHwRDScOjeGJaqVp5-5L6u5zzQ.run(Unknown Source:26)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: com.good.gd.ndkproxy.native2javabridges.error.GDNotAuthorizedErrorBridge: Not authorized. Call GDAndroid.authorize() first.
        at com.good.gd.database.sqlite.SQLiteConnection.nativeOpen(Native Method)
        at com.good.gd.database.sqlite.SQLiteConnection.open(SourceFile:208)
        at com.good.gd.database.sqlite.SQLiteConnection.open(SourceFile:192)
        at com.good.gd.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SourceFile:471)
        at com.good.gd.database.sqlite.SQLiteConnectionPool.open(SourceFile:192)
        at com.good.gd.database.sqlite.SQLiteConnectionPool.open(SourceFile:184)
        at com.good.gd.database.sqlite.SQLiteDatabase.openInner(SourceFile:869)
        at com.good.gd.database.sqlite.SQLiteDatabase.open(SourceFile:851)
        at com.good.gd.database.sqlite.SQLiteDatabase.openDb(SourceFile:754)
        at com.good.gd.database.sqlite.SQLiteDatabase.openDatabase(SourceFile:738)
        at com.good.gd.database.sqlite.SQLiteDatabase.openOrCreateDatabase(SourceFile:769)
        at com.blackberry.security.mtd.mhbbt.twy.otid(SourceFile:91)
        at com.blackberry.security.mtd.mhbbt.twy.<init>(SourceFile:138)
        at com.blackberry.security.mtd.mhbbt.twy.odwpg(SourceFile:84)
        at com.blackberry.security.mtd.mhbbt.yps.<clinit>(SourceFile:73)
        at com.blackberry.security.mtd.mhbbt.yps.odwpg(Unknown Source:0) 
        at com.blackberry.security.mtd.mhbbt.hgi.createCookieStore(SourceFile:202) 
        at com.good.gd.apache.http.impl.client.AbstractHttpClient.getCookieStore(SourceFile:351) 
        at com.blackberry.bbd.reactnative.networking.RNReactNativeBbdNetworkingModule.executeRequest(RNReactNativeBbdNetworkingModule.java:781) 
        at com.blackberry.bbd.reactnative.networking.RNReactNativeBbdNetworkingModule.lambda$sendRequest$0$RNReactNativeBbdNetworkingModule(RNReactNativeBbdNetworkingModule.java:691) 
        at com.blackberry.bbd.reactnative.networking.-$$Lambda$RNReactNativeBbdNetworkingModule$OuHwRDScOjeGJaqVp5-5L6u5zzQ.run(Unknown Source:26) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923)

All further network calls will throw the same error. It can only be solved by pausing and resuming the app again.

Current workaround

Our API calls currently don't make use of cookies for sessions. As such, we are able to circumvent this issue by forcing the GDHttpClient to use an in-memory implementation.

public class GDHttpRequestDelegate {

    public GDHttpClient getHttpClient() {
        GDHttpClient client = new GDHttpClient();
        client.setCookieStore(new CustomCookieStore());
        return new GDHttpClient();
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant