小编Clo*_*guy的帖子

b2c msal 用户没有现有会话并请求提示参数

当我通过以下方式登录时loginRedirect我可以看到重定向上填充了 MSAL 令牌,但是当尝试使用该令牌时,我收到此错误:

无法以静默方式从存储中检索令牌。

AADB2C90077:用户没有现有会话,并且在通过连接到 Azure B2C 的 Angular SPA 应用成功登录后,请求提示参数的值为“无”。

我在GitHub Issue中发现了类似的内容,然后在由于没有令牌而被迫执行此操作后出现错误后对另一个问题进行了评论:tokenPopup()

“此应用程序没有足够的权限对​​此 Web 资源执行该操作”

他们可能没有关系,但他们都阻止了我

在此代码中,loginredirect可以工作,我可以在本地存储中看到令牌,然后下次使用令牌时,我会收到控制台日志,authCallback-err然后记录“无法从存储中静默检索令牌...”并首先提到错误。

@Injectable()
export class MsalService {
  private access_token: string;

  private tenantConfig = {
    tenant: environment.tenant,
    clientID: environment.clientID,
    signUpSignInPolicy: environment.signUpSignInPolicy,
    b2cScopes: environment.b2cScopes
  };

  private authority = "https://login.microsoftonline.com/tfp/" +
    this.tenantConfig.tenant +
    "/" +
    this.tenantConfig.signUpSignInPolicy;

  private clientApplication: Msal.UserAgentApplication;

  private authCallback(errorDesc: any, token: any, error: any, tokenType: any) {
    var _this = this;
    console.log("authCallback");
    // For loginRedirect, tokenType …
Run Code Online (Sandbox Code Playgroud)

typescript azure-ad-b2c azure-ad-msal

5
推荐指数
1
解决办法
1816
查看次数

标签 统计

azure-ad-b2c ×1

azure-ad-msal ×1

typescript ×1