Unicode string (japanese-string) use atob is getting error when using OneDrive file picker for JavaScript v7.2

Edward Pham 1 Reputation point
2021-01-19T09:21:15.427+00:00

I retgisted an application in azure portal. I used OneDrive file picker for JavaScript v7.2 in my application.
I used an account in microsoft for enterprise to test our system.
My test account had name is "ABCD先生生03".
My code is:

 OneDrive.open({
 clientId: "My client Id",
        action: "share",
        multiSelect: true,
        advanced: {
            redirectUri: myRedirectUri
        },
        success: function(data) { /* my success function */ },
        cancel: function() { /* cancel handler */ },
        error: function(error) { /* error handler */ }
    });

and met a bug:

    [OneDriveSDK] Failed due to unknown error:  
        [Array(1)]
        0: Array(1)
        0: DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded. 
at Object.t.parseIdToken (https://myhost/js/OneDrive_2.js:4:15707) 
at Object.t.updateLoginHint (https://myhost/js/OneDrive_2.js:4:15032) 
at t.e.buildPickerUI (https://myhost/js/OneDrive_2.js:4:11272) 
at https://myhost/js/OneDrive_2.js:4:10037 
at https://myhost/js/OneDrive_2.js:12:2920 
at H (https://myhost/js/OneDrive_2.js:12:2954) 
at A (https://myhost/js/OneDrive_2.js:12:2734) 
at MutationObserver.f (https://myhost/js/OneDrive_2.js:12:705)
        code: 5
        message: "Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded."
        name: "InvalidCharacterError"
        stack: (...)
        get stack: ƒ ()
        set stack: ƒ ()
        __proto__: DOMException
        length: 1
        __proto__: Array(0)
        length: 1
        __proto__: Array(0)

When i change name of user to "ABC先生生03", i don't meet the bug again.
Please help to reslove it,
Thanks

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Deva-MSFT 2,271 Reputation points Microsoft Employee
    2021-01-20T16:30:18.857+00:00

    Quickly I made the above Microsoft Graph API call for OneDrive. It works fine with POSTMAN/Microsoft Graph Explorer. Hence its not an issue with the API. But sounds like with the libraries or dependencies or you might be using the older SDK.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.