我使用的示例来自:https://github.com/Azure-Samples/active-directory-b2c-javascript-msal-singlepageapp作为实现B2C注册的基础。使用msal连接到Azure B2C - 状态参数
如何在示例中传递状态参数?我看到有一个关于状态的问题,所以我想在示例中可以使用状态。但是,我无法弄清楚如何使用它以及在返回令牌后如何检索它。
我使用的示例来自:https://github.com/Azure-Samples/active-directory-b2c-javascript-msal-singlepageapp作为实现B2C注册的基础。使用msal连接到Azure B2C - 状态参数
如何在示例中传递状态参数?我看到有一个关于状态的问题,所以我想在示例中可以使用状态。但是,我无法弄清楚如何使用它以及在返回令牌后如何检索它。
在审阅source code for MSAL.js时,我看不到您如何控制state
的值。 AuthenticationRequestParameters
没有公开,并且当AuthenticationRequestParameters
是constructed时state
的值被设置为新的guid。
例:
在MSAL.js的下面的代码,我们有在authenticationRequest
可变的控制。
loginRedirect(scopes? : Array<string> , extraQueryParameters? : string): void {
...
this.authorityInstance.ResolveEndpointsAsync()
.then(() => {
const authenticationRequest = new AuthenticationRequestParameters(this.authorityInstance, this.clientId, scopes, ResponseTypes.id_token, this._redirectUri);
...
});
...
}
我很好奇。如果库正在创建状态参数,那么将它暴露给用户有什么好处? – user911
查看[this SO Post](https://stackoverflow.com/a/47546311/1851230)关于使用状态参数来控制重定向。 @ user911 – spottedmahn
你能提供一个'我看到有关国家的问题'的链接吗? – spottedmahn