login.live.com CORS error
See original GitHub issueCore Library
MSAL.js v2 (@azure/msal-browser)
Core Library Version
^2.19.0
Wrapper Library
Not Applicable
Wrapper Library Version
None
Description
I need to retrieve a token with scope “OneDrive.ReadWrite” for use with a file picker targeting OneDrive consumer (@live.com account). I setup the configuration as below and pass the scopes. As best I can tell from various available documents this should work. But I am currently stuck on a CORS error hitting “https://login.live.com/.well-known/openid-configuration” from localhost. I can hit that url directly so the url is correct.
My app has the correct redirects configured, is setup as a SPA, and works for all other cases (SharePoint, Graph).
For reference I reviewed this issue, associated PR, and the docs it updated.
Appreciate any guidance to the proper way to achieve getting a token from login.live.com.
MSAL Configuration
{
auth: {
authority: "https://login.live.com/",
clientId,
knownAuthorities: ["login.live.com"],
protocolMode: "OIDC",
redirectUri: "http://localhost:3000",
},
}
Relevant Code Snippets
import { Configuration, PublicClientApplication } from "@azure/msal-browser";
const app = new PublicClientApplication(config);
let accessToken: string;
const authParams = { scopes: scopes || [`${combine(command.resource, ".default")}`] };
try {
// see if we have already the idtoken saved
const resp = await app.acquireTokenSilent(authParams);
accessToken = resp.accessToken;
} catch (e) {
// per examples we fall back to popup
const resp = await app.loginPopup(authParams);
if (resp.account) {
app.setActiveAccount(resp.account);
}
if (resp.idToken) {
const resp2 = await app.acquireTokenSilent(authParams);
accessToken = resp2.accessToken;
} else {
this.error(e);
}
}
if (accessToken) {
this.log(`Returning token for auth type: '${command.type}'`, 0);
result = {
result: "token",
token: accessToken,
}
}
Identity Provider
Other
Source
Internal (Microsoft)
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
@patrick-rodgers thanks for raising the issue, I’ve gone through your description and the issues/PRs/docs you link to and haven’t seen an obvious answer here. I’ll look into it and get back to you soon.
Hmm, I got the below error, guessing this choice isn’t in the UI due to some conditions in the back end - switching probably isn’t supported. All good. I am going to create a new registration to test. Thanks for your help!