`Error occurred while verifying params unable to verify jwt token` Apple and Twitter custom auth

Hi! We are having some issues with Custom Authentication for Twitter and Apple, with slightly different errors for both.
For reference, we are already able to successfully connect using Google and Discord custom auth.

  • SDK Version: 15.1.0
  • Platform: React Native - Expo SDK 51

Apple.

  • Verifier Name: rn-apple.0
  • Error: [Error: Error occurred while verifying params unable to verify jwt token, [failed to verify jws signature: failed to verify message: crypto/rsa: verification error failed to verify jws signature: failed to verify message: crypto/rsa: verification error]]

Twitter
From twitter auth0 we are only receiving an access_token

  • Verifier Name: rn-twitter.0
  • Error: [Error: Error occurred while verifying params unable to verify jwt token, [failed to verify jws signature: failed extract from compact serialization format: invalid number of segments failed to verify jws signature: failed extract from compact serialization format: invalid number of segments]]

tKey Initialization

Hi João! Thank you for reaching out to the Web3Auth community. I’ve gathered the details from your message to help our support team address the issues you’re facing with Custom Authentication for both Twitter and Apple.

SDK Details:

  • SDK: tKey JS SDK
  • SDK Version: 15.1.0
  • Platform: React Native - Expo SDK 51

Issues Encountered:

  1. Apple Custom Auth:

    • Verifier Name: rn-apple.0
    • Error: Error occurred while verifying params unable to verify jwt token, [failed to verify jws signature: failed to verify message: crypto/rsa: verification error]
    • Screenshot:
  2. Twitter Custom Auth:

    • Verifier Name: rn-twitter.0
    • Error: Error occurred while verifying params unable to verify jwt token, [failed to verify jws signature: failed extract from compact serialization format: invalid number of segments]
    • Screenshot:

tKey Initialization:

Next Steps:

To assist further, it would be great to have:

  • Your Web3Auth initialization and login code snippets (if you haven’t shared them already).

Since you’re already successfully connecting with Google and Discord, we will work to identify what might be going wrong with the Apple and Twitter integrations.

Feel free to share any additional links or information that might be relevant. Looking forward to helping you resolve these issues!

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

Hey @ferreiro,

While reviewing the verifier details, I noticed that you have configured it to use Auth0 with Twitter. I believe you’re receiving the idToken in the tokenRes, but in your code, it seems you are passing the access_token instead of the idToken.

Could you please share the JWT token you receive from Auth0? Additionally, can you explain how you are initiating the login process to obtain the idToken?

Hi @shahbaz!

For Twitter Auth0 we are using expo-auth-session.

Any ResponseType in the useAuthRequest config other than code doesn’t work (token or idToken). But then we are using this authorization code to request a token directly to https://api.x.com/2/oauth2/token and that’s our tokenRes. The issue is that we are only receiving an access token, no Id Token. tokenRes example:

{"access_token": "NlBiX0dVN2hoVXJsR3pudENNX18wNTVReWItMUtxV0dyaXIzTndxODc5OE5rOjE3MzE5MjUzNTYzODU6MTowOmF0OjE", "expires_in": 7200, "scope": "users.read tweet.read", "token_type": "bearer"}

A similar thing happened with discord. We only receive a bearer access token from discord’s /token endpoint, but in this one passing that token to the idToken param of the connect method works perfectly