thingsboard / flutter_thingsboard_app

ThingsBoard Mobile Application
https://thingsboard.io/products/mobile/
BSD 3-Clause "New" or "Revised" License
208 stars 155 forks source link

Unable to Login and view dashboard #35

Closed MM-06 closed 5 months ago

MM-06 commented 1 year ago

Hey guys,

I've followed all the steps from the setup tutorial (https://thingsboard.io/docs/pe/mobile/getting-started/) accurately. If I set the endpoint to the ThingsBoard cloud (https://thingsboard.cloud) then the app works perfectly, but if I set the endpoint to my ThingsBoard PE server instance, then I can't login to the app. On the server, it does indicate a successful login however nothing changes on the app. Has anyone experienced this problem or could they advise on a solution? Thanks

salemsw commented 1 year ago

I'm facing the same issue, this is part of my log: flutter: ERROR │ ThingsboardError: message: [Unauthorized!], errorCode: null, status: null flutter: ERROR │ #0 toThingsboardError (package:thingsboard_pe_client/src/error/_thingsboard_error_handler_io.dart:89:18) flutter: ERROR │ #1 HttpInterceptor.onError (package:thingsboard_pe_client/src/interceptor/http_interceptor.dart:104:19) flutter: ERROR │ #2 DioMixin.fetch._errorInterceptorWrapper... (package:dio/src/dio_mixin.dart:574:28) flutter: ERROR │ #3 DioMixin.checkIfNeedEnqueue (package:dio/src/dio_mixin.dart:789:22) flutter: ERROR │ #4 DioMixin.fetch._errorInterceptorWrapper.. (package:dio/src/dio_mixin.dart:572:22) flutter: ERROR │ #5 new Future. (dart:async/future.dart:253:37) flutter: ERROR │ #6 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15) flutter: ERROR │ #7 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19) flutter: ERROR │ #8 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5) flutter: ERROR │ #9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12) flutter: ERROR │ flutter: ERROR ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄

salemsw commented 1 year ago

with https://thingsboard.cloud/ no issues at all

MM-06 commented 1 year ago

Same, perhaps there are other parts that need changing as well.

hieunvce commented 1 year ago

I've upgrade my ThingsBoard CE server instance to the latest version and it works now.

I think the reason why you set the endpoint to the ThingsBoard cloud (https://thingsboard.cloud/) then the app works perfectly is the ThingsBoard cloud run the latest version of ThingsBoard PE.

Puritath commented 1 year ago

I'm facing the same issue, this is part of my log: flutter: ERROR │ ThingsboardError: message: [Unauthorized!], errorCode: null, status: null flutter: ERROR │ #0 toThingsboardError (package:thingsboard_pe_client/src/error/_thingsboard_error_handler_io.dart:89:18) flutter: ERROR │ #1 HttpInterceptor.onError (package:thingsboard_pe_client/src/interceptor/http_interceptor.dart:104:19) flutter: ERROR │ #2 DioMixin.fetch._errorInterceptorWrapper... (package:dio/src/dio_mixin.dart:574:28) flutter: ERROR │ #3 DioMixin.checkIfNeedEnqueue (package:dio/src/dio_mixin.dart:789:22) flutter: ERROR │ #4 DioMixin.fetch._errorInterceptorWrapper.. (package:dio/src/dio_mixin.dart:572:22) flutter: ERROR │ #5 new Future. (dart:async/future.dart:253:37) flutter: ERROR │ #6 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15) flutter: ERROR │ #7 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19) flutter: ERROR │ #8 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5) flutter: ERROR │ #9 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12) flutter: ERROR │ flutter: ERROR ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄

same problems. After updated 3.4.3 . My app can't login. I try for downgrade to 3.4.1. it can login .

(I used TB PE)

serteperte commented 1 year ago

Same incident. After upgraded TB PE 3.4.1 to 3.4.3, I can't login to mobile app. Same situation with 3.4.4 PE version. If I downgraded to 3.4.1, it's working.

QuakeString commented 10 months ago

I can't also login. I've tried with the demo server, I've tried with own server. in both case got the same issue. and same debug output as below.


E/SecureStorageAndroid( 5540): StorageCipher initialization failed
E/SecureStorageAndroid( 5540): java.security.ProviderException: Failed to generate key pair.
E/SecureStorageAndroid( 5540):  at android.security.keystore2.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPairHelper(Unknown Source:233)
E/SecureStorageAndroid( 5540):  at android.security.keystore2.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPair(Unknown Source:11)
E/SecureStorageAndroid( 5540):  at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java:746)
E/SecureStorageAndroid( 5540):  at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.createKeys(RSACipher18Implementation.java:145)
E/SecureStorageAndroid( 5540):  at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.createRSAKeysIfNeeded(RSACipher18Implementation.java:112)
E/SecureStorageAndroid( 5540):  at com.it_nomads.fluttersecurestorage.ciphers.RSACipher18Implementation.<init>(RSACipher18Implementation.java:36)
E/SecureStorageAndroid( 5540):  at com.it_nomads.fluttersecurestorage.ciphers.KeyCipherAlgorithm$$ExternalSyntheticLambda0.apply(Unknown Source:2)
E/SecureStorageAndroid( 5540):  at com.it_nomads.fluttersecurestorage.ciphers.StorageCipherFactory.getCurrentStorageCipher(StorageCipherFactory.java:82)
E/SecureStorageAndroid( 5540):  at com.it_nomads.fluttersecurestorage.FlutterSecureStorage.initStorageCipher(FlutterSecureStorage.java:181)
E/SecureStorageAndroid( 5540):  at com.it_nomads.fluttersecurestorage.FlutterSecureStorage.ensureInitialized(FlutterSecureStorage.java:154)
E/SecureStorageAndroid( 5540):  at com.it_nomads.fluttersecurestorage.FlutterSecureStorage.write(FlutterSecureStorage.java:102)
E/SecureStorageAndroid( 5540):  at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin$MethodRunner.run(FlutterSecureStoragePlugin.java:139)
E/SecureStorageAndroid( 5540):  at android.os.Handler.handleCallback(Unknown Source:2)
E/SecureStorageAndroid( 5540):  at android.os.Handler.dispatchMessage(Unknown Source:4)
E/SecureStorageAndroid( 5540):  at android.os.Looper.loopOnce(Unknown Source:182)
E/SecureStorageAndroid( 5540):  at android.os.Looper.loop(Unknown Source:82)
E/SecureStorageAndroid( 5540):  at android.os.HandlerThread.run(Unknown Source:28)
E/SecureStorageAndroid( 5540): Caused by: android.security.KeyStoreException: Unknown error (internal Keystore code: -1000 message: In generate_key.
E/SecureStorageAndroid( 5540): 
E/SecureStorageAndroid( 5540): Caused by:
E/SecureStorageAndroid( 5540):     0: While generating Key without explicit attestation key.
E/SecureStorageAndroid( 5540):     1: Error::Km(ErrorCode(-1000))) (public error code: 10 internal Keystore code: -1000)
E/SecureStorageAndroid( 5540):  at android.security.KeyStore2.getKeyStoreException(Unknown Source:87)
E/SecureStorageAndroid( 5540):  at android.security.KeyStoreSecurityLevel.handleExceptions(Unknown Source:33)
E/SecureStorageAndroid( 5540):  at android.security.KeyStoreSecurityLevel.generateKey(Unknown Source:12)
E/SecureStorageAndroid( 5540):  at android.security.keystore2.AndroidKeyStoreKeyPairGeneratorSpi.generateKeyPairHelper(Unknown Source:98)
E/SecureStorageAndroid( 5540):  ... 16 more
D/DecorView[]( 5540): onWindowFocusChanged hasWindowFocus false
I/Ha
```ndWritingStubImpl( 5540): isKeyboardTypeChanged: false
ybeshkarov commented 5 months ago

Hello, @MM-06!

If you want to use the PE backend then you need to use the PE source code https://github.com/thingsboard/flutter_thingsboard_pe_app

Follow the PE manual https://thingsboard.io/docs/pe/mobile/getting-started/.

Best regards!