# Ledger API with Auth0 JWKS gives Authorization error

**URL:** <https://forum.canton.network/t/ledger-api-with-auth0-jwks-gives-authorization-error/3187>\
**Category:** App Development\
**Tags:** sandbox, ledger-api\
**Created:** [September 22, 2021, 6:49am UTC](https://forum.canton.network/t/ledger-api-with-auth0-jwks-gives-authorization-error/3187 "2021-09-22T06:49:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Theja](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@Theja](https://forum.canton.network/u/Theja)\
**Post date:** [September 22, 2021, 6:49am UTC](https://forum.canton.network/t/ledger-api-with-auth0-jwks-gives-authorization-error/3187/1 "2021-09-22T06:49:55Z")

</div>

Hi,

I’m running sandbox locally with --auth-jwt-rs256-jwks pointed to a valid Auth0 JWKS. When the client tries to connect using a valid token from Auth0, I see an error saying  
“ **c.d.ledger.api.auth.AuthServiceJWT$ - Authorization error: Could not verify JWT token: The Token’s Signature resulted invalid when verified using the Algorithm: SHA256withRSA** ”

I verified the token on [jwt.io](http://jwt.io) and the signature is valid. Also used Auth0 JWT lib to validate the token and it seems fine. I believe the same lib ([GitHub - auth0/java-jwt: Java implementation of JSON Web Token (JWT)](https://github.com/auth0/java-jwt)) is used in Ledger API implementation.

What could be the possible reason for Ledger API to reject this connection. Am I missing something?

Your help is much appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![bernhard](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/bernhard/32/356_2.png) [@bernhard](https://forum.canton.network/u/bernhard)\
**Post date:** [September 22, 2021, 7:46am UTC](https://forum.canton.network/t/ledger-api-with-auth0-jwks-gives-authorization-error/3187/2 "2021-09-22T07:46:26Z")

</div>

Hi @Theja, Could you double check that the algorithm matches? Ie when you verified your token on [jwt.io](http://jwt.io), did you select rs256 rather than the default hs256 algorithm? Auth0 supports both, but Sandbox only supports rs256, not hs256, I believe.

---

<div class="post-metadata">

**Author:** ![Theja](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@Theja](https://forum.canton.network/u/Theja)\
**Post date:** [September 22, 2021, 9:41am UTC](https://forum.canton.network/t/ledger-api-with-auth0-jwks-gives-authorization-error/3187/3 "2021-09-22T09:41:02Z")

</div>

Thanks for the response @bernhard. Yes, I double checked it’s RS256 and the algorithm matches. Please let me know if you need further details.

---

<div class="post-metadata">

**Author:** ![Gary\_Verhaegen](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/gary_verhaegen/32/81_2.png) [@Gary\_Verhaegen](https://forum.canton.network/u/Gary_Verhaegen)\
**Post date:** [September 22, 2021, 11:44am UTC](https://forum.canton.network/t/ledger-api-with-auth0-jwks-gives-authorization-error/3187/4 "2021-09-22T11:44:30Z")

</div>

Hi @Theja,

Normally there would be security issues with sharing the token, but I think in this case it should be fine as the token is only valid for a temporary, local sandbox.

Would you mind sharing both the token you’re using and the JWKS URL of your Auth0 tenant? Once we’re done debugging, you can delete that tenant and create a new one with a working configuration, which should address any security concern.

Alternatively, if this tenant is not one you can destroy (say, it’s already used for something else), would you mind creating a new, temporary tenant on which you can reproduce the issue and sharing that one? From the Auth0 console, you can create a new tenant from the dropdown in the top left.

---

<div class="post-metadata">

**Author:** ![Theja](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@Theja](https://forum.canton.network/u/Theja)\
**Post date:** [September 23, 2021, 1:44am UTC](https://forum.canton.network/t/ledger-api-with-auth0-jwks-gives-authorization-error/3187/5 "2021-09-23T01:44:30Z")

</div>

Thanks @Gary_Verhaegen for the response. I’m closing this issue here as it is related to the client side configuration of the access token. Apologies.

It is working as expected 🙂
