Skip to content

Conversation

@Vitor-Avila
Copy link
Contributor

@Vitor-Avila Vitor-Avila commented Sep 12, 2025

An atob error could was being logged in the console depending on the payload used to generate the guest token. Example problematic payload:

{
    "user": {"username": "[email protected]", "first_name": "Vitor", "last_name": "Avila"},
    "resources": [{"type": "dashboard", "id": "${DASHBOARD_ID}"}],
    "rls": [
        {"clause": "user_visibility @> ARRAY['[email protected]']"},
    ],
}

Error faced:

Uncaught (in promise) InvalidCharacterError: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.

atob does not handle base64url encoded tokens. This PR updates the implementation to use jwt-decode (same approach as Superset OSS: https://github.com/apache/superset/blob/master/superset-embedded-sdk/src/guestTokenRefresh.ts#L19-L27

@Vitor-Avila Vitor-Avila merged commit e5a1f56 into main Sep 12, 2025
1 check passed
@Vitor-Avila Vitor-Avila deleted the fix/parse-token-fix branch September 12, 2025 22:10
@Vitor-Avila Vitor-Avila mentioned this pull request Sep 12, 2025
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

Successfully merging this pull request may close these issues.

3 participants