I have tried using Dialog API and office-js-helpers for authenticating users in my Outlook Addin React app and both of them create pop-ups for auth but they are both blank screens. Both methods return the following error
The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature.
At first I thought this may be because my Auth domain was not listed in my manifest with an AppDomain
tag, but I have since added it and reinstalled my add-in with no success.
Here are the two versions I have tried:
Office.context.ui.displayDialogAsync('https://foobar.auth.us-east-1.amazoncognito.com/login?client_id=MY_CLIENT_ID&response_type=code&redirect_uri=https://localhost:3000', {height: 30, width: 20});
and
authenticator.endpoints.add('Cognito', {
redirectUrl: 'https://localhost:3000',
baseUrl:'https://foobar.auth.us-east-1.amazoncognito.com/oauth2',
authorizeUrl: '/authorize',
responseType: 'token',
tokenUrl: '/token',
state: false,
nonce: false,
scope: 'openid',
extraQueryParameters:null,
clientId: 'MY_CLIENT_ID'
});
//for the default Microsoft endpoint
authenticator
.authenticate('Cognito')
.then(function (token) { return console.log('good') })
.catch(function(err)
{
OfficeHelpers.Utilities.log();
console.log("CATCH ERROR")
console.log(JSON.stringify(err))
});
I don't particularly care which method I use, I just need one of them to work.