Hi.
I am trying to roll my own login page with React. When the root component of the app mounts, this method is fired:
initializeWebAuth() {
let config = JSON.parse(
decodeURIComponent(escape(window.atob('@@config@@')))
);
const params = Object.assign({
overrides: {
__tenant: config.auth0Tenant,
__token_issuer: process.env.REACT_APP_CUSTOM_DOMAIN
},
domain: config.auth0Domain,
clientID: config.clientID,
redirectUri: config.callbackURL,
responseType: 'token'
}, config.internalOptions);
this.webAuth = new window.auth0.WebAuth(params);
}
But this is crashing the app with the following error:
DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
Things I can confirm:
-
process.env.REACT_APP_CUSTOM_DOMAIN
is set and correct - window.auth0 is loaded and looks like this:
My best guess is that it’s a race condition and that the '@@config@@'
is waiting to be replaced with the proper payload but have not yet been able to sort that out.
Any insight would be greatly appreciated