我使用 msal-browser 包进行身份验证,并尝试设置code_challenge
我想要的东西,而不是 msal-browser 自动生成的东西。
import * as msal from "@azure/msal-browser";
import pkceChallenge from "pkce-challenge"
const msalConfig = {
auth: {
clientId: "GUID", // This is the ONLY mandatory field; everything else is optional.
authority: "https://{tenant}.b2clogin.com/{tenant}.onmicrosoft.com/B2C_signin_flow", // Choose sign-up/sign-in user-flow as your default.
knownAuthorities: [{authority}], // You must identify your tenant's domain as a known authority.
redirectUri: "http://localhost:6420", // You must register this URI on Azure Portal/App Registration. Defaults to "window.location.href".
}
};
const b2cScopes = ["https://{tenant}.onmicrosoft.com/010eb29e-d42b-4ca3-9c16-1961a528ce67/tasks.read",
"https://{tenant}.onmicrosoft.com/010eb29e-d42b-4ca3-9c16-1961a528de77/tasks.write"];
const myMSALObj = new msal.PublicClientApplication(msalConfig);
const pkce = pkceChallenge();
const loginRequest = {
scopes: ["openid", ...b2cScopes],
codeChallenge: pkce.code_challenge
}
myMSALObj.loginRedirect(loginRequest)
看起来上面的内容似乎不能作为loginRedirect
不期望codeChallenge
属性存在的输入参数。
我该如何设置?