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

validateIDToken for Asgardeo React Native SDK not working #183

Open
miguelbwso2 opened this issue Mar 15, 2022 · 0 comments
Open

validateIDToken for Asgardeo React Native SDK not working #183

miguelbwso2 opened this issue Mar 15, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@miguelbwso2
Copy link

We are testing the Asgardeo React Native sample application (https://github.com/asgardeo/asgardeo-react-native-oidc-sdk/tree/main/sample). But when we use the option "validateIDToken": true (default option) there is a problem inside the method validateIdToken in /src/helpers/authentication-helper.ts

When is executed the following code fragment:

return this._cryptoHelper
.getJWKForTheIdToken(idToken.split(".")[ 0 ], parsedResponse.keys)
.then(async (jwk: any) => {
return this._cryptoHelper
.isValidIdToken(
idToken,
jwk,
(await this._config()).clientID,
issuer,
this._cryptoHelper.decodeIDToken(idToken).sub,
(await this._config()).clockTolerance
)
The react native application doesn't respond.

We've tried the following workaround (remove the async declarative from the .getJWKForTheIdToken call) and worked.

const jwk = this._cryptoHelper.getJWKForTheIdToken(idToken.split(".")[ 0 ], parsedResponse.keys);

return this._cryptoHelper
.isValidIdToken(
idToken,
jwk,
(await this._config()).clientID,
issuer,
this._cryptoHelper.decodeIDToken(idToken).sub,
(await this._config()).clockTolerance
)

As additional information, for the asgardeo-react-native sdk the function getJWKForTheIdToken invokes the public parseJwk method (https://github.com/asgardeo/asgardeo-react-native-oidc-sdk/blob/main/lib/src/crypto-utils.ts)

@miguelbwso2 miguelbwso2 added the bug Something isn't working label Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant