Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JWT-Authentication doesnt work anymore since SDK 3.0.0 #28

Open
fhartmann-erp opened this issue Jun 7, 2021 · 16 comments
Open

JWT-Authentication doesnt work anymore since SDK 3.0.0 #28

fhartmann-erp opened this issue Jun 7, 2021 · 16 comments

Comments

@fhartmann-erp
Copy link

When using the same JWT which works with SDK-Version 2.8.0 i always get the error: "JWT Login Failed". When debugging the Error of the jwtAuthenticator.authorize method says error code -7000 "UNEXPECTED_ERROR".

@ankibatr
Copy link
Collaborator

ankibatr commented Jun 9, 2021

@fhartmann-erp

  1. Have you called initialize API before calling any webex API as mentioned in Migration-Guide-for-v2-to-v3?

NOTE: We need to wait for the response of webex.initialize API. After getting the response we need to decide whether we are already logged in or we need to authorize the user.

ReadMe Doc

@fhartmann-erp
Copy link
Author

I used it like in this example:
webex.initialize(CompletionHandler { result -> if (result.error != null) { //already authorised } else { authenticator.authorize(loginWebview, CompletionHandler { result -> if (result.error != null) { //Handle the error }else{ //Authorization successful } }) } })

I also tried it with the KitchenSink Sample App by just pasting a JWT which worked in previous versions and got the same error like mentioned before.

@ankibatr
Copy link
Collaborator

ankibatr commented Jun 9, 2021

How you generated the JWT token?

@fhartmann-erp
Copy link
Author

With the package io.jsonwebtoken for Android. Also created a JWT Token manually on https://jwt.io/ and it also does not work

@fhartmann-erp
Copy link
Author

Found this in the logs:

2021-06-14 08:31:38.809 9022-9022/com.cisco.sdk_android D/WBX_TEAMS-ch: [FUNCTION_CALL] ZygoteInit.java::1386 main:IOmniusServiceBridge.loginWithJWT()
2021-06-14 08:31:38.815 9022-9094/com.cisco.sdk_android D/WBX_TEAMS-ucf: tid[548225411736] OmniusService.cpp::194 loginWithJWT:Unable to parse Guest Issuer JWT

The JWT-Token i used was working fine in SDK Version 2.8.0. Is there something that got changed where the JWT gets Validated/Parsed?

@ankibatr
Copy link
Collaborator

ankibatr commented Jun 14, 2021

Does your payload looks like below example?
https://developer.webex.com/docs/guest-issuer
Screenshot 2021-06-14 at 12 30 27 PM

  • Is your expiry param is number or string?

@fhartmann-erp
Copy link
Author

I adjusted my payload and in the sample app the token works now but when using the sdk in my java based android application i get an unexpected error -7000 at webex.initialize. After that the app always crashes when initiating a call:
E/libc++abi: terminating with uncaught exception of type spark::expired_reference_exception: NSt6__ndk18weak_ptrI17ITelephonyServiceEE reference has expired A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 30574 (plus.vrvideoapp)

@ankibatr
Copy link
Collaborator

You can not use the Webex APIs until authorised successful (cached or fresh login):
webex.initialize(CompletionHandler { result -> if (result.error != null) { //already authorised } else { authenticator.authorize(loginWebview, CompletionHandler { result -> if (result.error != null) { //Handle the error }else{ //Authorization successful } }) } })

@fhartmann-erp
Copy link
Author

When trying to authorize, even if the initialization-Method throws an error, i get the following error in the logs:
2021-06-14 12:58:32.325 1062-1108/com.erpplus.vrvideoapp E/WBX_TEAMS-ucf: tid[547549303888] OmniusAdapter.cpp::212 operator():Failed to fetch AccessToken from JWT 2021-06-14 12:58:32.331 1062-1112/com.erpplus.vrvideoapp D/Authorize:: null

The same token works in the sample app but not when using the sdk in my java android application

@adamrangs
Copy link

@jbenyovs - request you to please help setup a call with @fhartmann-erp for us to do a screen share

@jbenyovs
Copy link

@adamrangs I have setup a Webex space with you and @fhartmann-erp to discuss the details of a call.

@fhartmann-erp
Copy link
Author

I think i've got it to work, i copied the permissions in the AndroidManifest.xml from the Example App in my App and then the authentication works and i could make a call. Is there any new permissions the WebexSDK needs in the newer version?

@ankibatr
Copy link
Collaborator

Good to hear that it works for you.

  • Can you please list the permissions you copied from the sample app to make authentication work?
  • I don't think any extra permission is needed for authentication at least. Basic permission of Internet etc. is needed.

@fhartmann-erp
Copy link
Author

Seems like the Internet-Permission was missing, didnt need that for the SDK Version 2.8.0.
Also, when the app gets launched for the first time the initialize-Method always throws an "Unexpected Error -7000", but if i call the authenticate-Method anyways, it works. Launching the app for the second time, the initialize-Method doesnt throw an error.

@Ramaraju1992
Copy link

I am facing same issue while authenticating JWT token, and error message logged below.

D/WBX_TEAMS-ch: [FUNCTION_CALL] ZygoteInit.java::930 main:IOmniusServiceBridge.getGuestIssuerJwtExpiration()
D/WBX_TEAMS-ch: [FUNCTION_RETURN] ZygoteInit.java::930 main:<-- 7ms IOmniusServiceBridge.getGuestIssuerJwtExpiration(): void
D/WBX_TEAMS-ch: [FUNCTION_CALL] ZygoteInit.java::930 main:IOmniusServiceBridge.getGuestIssuerJwtExpiration()
D/WBX_TEAMS-ch: [FUNCTION_RETURN] ZygoteInit.java::930 main:<-- 7ms IOmniusServiceBridge.getGuestIssuerJwtExpiration(): void
W/System.err: java.lang.IllegalStateException: bridge.guestIssuerJwtExpiration must not be null
W/System.err: at com.ciscowebex.androidsdk.OmniusWrapper.getGuestIssuerJwtExpiration(OmniusWrapper.kt:211)
W/System.err: at com.ciscowebex.androidsdk.auth.JWTAuthenticator.isAuthorized(JWTAuthenticator.kt:44)
W/System.err: at com.example.asterciscokotlin.MainActivity$onCreate$1.onClick(MainActivity.kt:29)

Error messages debugging is java.lang.IllegalStateException: bridge.guestIssuerJwtExpiration must not be null

@fhartmann-erp
Copy link
Author

Since SDK 3.0.0 you have to set the expiration of the JWT. In the previous version it worked without setting the expiration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants