'Invalid number of segments' when using custom jwt auth

I’m using Web3Auth with custom JWT authentication, and I’m encountering an “invalid number of segments” error. I’ve verified that the JWT format and fields are correct, with the required issuer and aud values matching Web3Auth’s configuration. The token structure, algorithm, and encoding also appear to be properly set up. However, the error persists.

Could this issue be related to any specific configuration in the Web3Auth SDK, or are there any additional requirements or known issues that might cause this error? Any guidance would be greatly appreciated.

Example id token : eyJraWQiOiI5ZjI1MmRhZGQ1ZjIzM2Y5M2QyZmE1MjhkMTJmZWEiLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJmNTkwMjNkMjhlMjM4YmQ2MjJjY2Q1ZjFjMzRlYTk1ZiIsInN1YiI6IjM0MDYzOTAwNjEiLCJhdXRoX3RpbWUiOjE3MzAzNzI4ODAsImlzcyI6Imh0dHBzOi8va2F1dGgua2FrYW8uY29tIiwiZXhwIjoxNzMwNDE2MDgwLCJpYXQiOjE3MzAzNzI4ODB9.kat5qpOzYujtisAhVSlXSYWqGc_rVNjlZxwb827zeNm9-IH2ORbiXQmmn7qa-XjObuKroZDnPh8IgeQAemtIqri5AlNkEBZOqL9UBJpb0nRv93fWSOdkiQQp7F41uPvrJvpqmc1SR5sRDnrDlQPJF9QKr8T9cVnyNU2hgpodiFsnrQb-iVZFeSPUPntnlMCjhpswYVyxIb4zH6VUIDRauGI57YjJsTZe9oprT7XeD0uKTLxO-aBAqziGCO07axYBTtoDsv0-tZTrtLVKjgYRN1ed9eDtR-3jKJ5mdX-tEHe8SkjXIewuXCwpRNj-nFcZfkc_B7fNx2Lpmyxhob9_4g

sdk versions
@web3auth/ethereum-provider”: “^9.3.0”,
@web3auth/react-native-sdk”: “^7.0.1”,

Hello Denis!

Thank you for detailing the issue you’re facing with the custom JWT authentication in Web3Auth. Let’s summarize the essential information for the support team:

Issue Summary:

  • SDK Details: Help - Plug n Play
  • Error: “Invalid number of segments” when using custom JWT authentication.
  • SDK Versions:
    • @web3auth/ethereum-provider: ^9.3.0
    • @web3auth/react-native-sdk: ^7.0.1
  • Example ID Token: (Provided)

Additional Notes:

  • You mentioned that you’ve verified the JWT format and fields, including the issuer and aud values, and that the token structure, algorithm, and encoding are set up properly.
  • Screenshots attached may provide further context about the error.

Questions for Consideration:

  • Have you checked if your JWT is properly encoded (base64url) as the error often indicates a problem with the structure?
  • Is the ID Token being passed to Web3Auth correctly formatted before usage?
  • Are there specific configurations done in the Web3Auth SDK that might affect the JWT?

Feel free to provide any additional information or code snippets if you think they might help clarify the situation!

Your query is now recorded, and our support team will take a closer look at this issue. We hope to get you back on track soon! If you have any other questions or need further assistance, just let us know.

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.

And here is my codes


스크린샷 2024-10-31 오후 8.10.17

Hey @boxfoxsg619

I see a couple of issues in the code and want to confirm the verifier details with you.

You’re using verifier: 'kakao' which is on sapphire_devnet, and from the screenshot it looks like you have created a custom type verifier. But I don’t see kakao named verifier which is of type custom. Can you share the full page screenshot of the verifier creation page? or the name of your verifier.

You should not be passing the domain here. Just to confirm, is this a custom jwt flow or are you using Auth0? Also, please show how are you getting the value in res? res.idToken.

It is custom jwt flow. Not using Auth0
The same problem occurs even if you do not enter the domain value.

In that case, please pass kakao-jwt as your verifier name. and not kakao.

Same…


스크린샷 2024-11-04 오후 7.42.30

Please don’t pass the verifierSubIdentifier here.

After that, error is changed…

Hey @boxfoxsg619

Could you provide more details about how you are obtaining the JWT? Also the code of this function and the steps you did to configure Kakao.

const res = await login();

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.