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

DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded. #6492

Closed
Michael-006 opened this issue Sep 18, 2023 · 11 comments
Assignees
Labels
b2c Related to Azure B2C library-specific issues bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.

Comments

@Michael-006
Copy link

Core Library

MSAL.js (@azure/msal-browser)

Core Library Version

?

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

3.0.4

Public or Confidential Client?

Public

Description

When having special characters in the displayName like my tester special charactersčćęèéêëėįìíîï msal throws an error "Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."

After this error I'm getting:

ClientAuthError: token_parsing_error: Token cannot be parsed. Please review stack trace to determine root cause. Failed with error: InvalidCharacterError: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.

Error Message

DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.

Msal Logs

No response

MSAL Configuration

not relevant

Relevant Code Snippets

try {
    const oe = S(Q);
    return JSON.parse(oe)
} catch (oe) {
    throw d.e.createTokenParsingError(oe)
}

Reproduction Steps

Set display name to my tester special charactersčćęèéêëėįìíîï

Expected Behavior

no error, should decode correctly

Identity Provider

Azure B2C Custom Policy

Browsers Affected (Select all that apply)

Chrome

Regression

No response

Source

External (Customer)

@Michael-006 Michael-006 added bug-unconfirmed A reported bug that needs to be investigated and confirmed question Customer is asking for a clarification, use case or information. labels Sep 18, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Attention 👋 Awaiting response from the MSAL.js team label Sep 18, 2023
@github-actions github-actions bot added b2c Related to Azure B2C library-specific issues msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications labels Sep 18, 2023
@Mexx77
Copy link

Mexx77 commented Sep 19, 2023

we see the same issue with the special character ł in the lastname of the user

@jansepke
Copy link

possible duplicate of #6476

@microsoft-github-policy-service
Copy link
Contributor

This issue requires attention from the MSAL.js team and has not seen activity in 5 days. @hectormmg please follow up.

@fredliex
Copy link

fredliex commented Sep 28, 2023

in commit 2ef47fe , some code are missing.

should be as follows

const binString = atob(base64String.replace(/-/g, "+").replace(/_/g, "/"));

lalimasharda added a commit that referenced this issue Oct 4, 2023
Addresses base64 decoding errors reported by customers and #6492
@tnorling
Copy link
Collaborator

tnorling commented Oct 9, 2023

This has been fixed in 3.2.0

@tnorling tnorling closed this as completed Oct 9, 2023
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs: Attention 👋 Awaiting response from the MSAL.js team label Oct 9, 2023
@MohanMugi
Copy link

@fredliex you are a life saver...
Thank you!

@MaikL
Copy link

MaikL commented Nov 27, 2023

Are there different rollout phases for this bugfix?
In the AzureEU Cloud I still get the same error, when I try to add a password to my gateway.

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

@tnorling
Copy link
Collaborator

Are there different rollout phases for this bugfix? In the AzureEU Cloud I still get the same error, when I try to add a password to my gateway.

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

This is a client library, not a service, there is no "rollout". Your application or whatever is invoking MSAL.js will need to install and deploy the latest version with the fix.

@MaikL
Copy link

MaikL commented Nov 29, 2023

OK, sorry I missed to reference some circumstances.
The Error occurs on the Gateway configuration page of Power BI (https://app.powerbi.com/groups/me/gateways).
When I try to enter the username and password for a Basic Authentification Method. So I think this is on Microsofts side to add these changes.

@MohanMugi
Copy link

MohanMugi commented Nov 29, 2023 via email

@MaikL
Copy link

MaikL commented Dec 4, 2023

I am sorry, my problem is solved. The error was, that I installed the "standard Gateway" not the "personal Gateway".
Why there is no specific error, which hints to this problem is beyond my horizon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b2c Related to Azure B2C library-specific issues bug-unconfirmed A reported bug that needs to be investigated and confirmed msal-angular Related to @azure/msal-angular package msal-browser Related to msal-browser package public-client Issues regarding PublicClientApplications question Customer is asking for a clarification, use case or information.
Projects
None yet
Development

No branches or pull requests

8 participants