MSAL和IOS -无法确定B2C示例的权限

q8l4jmvw  于 2023-01-10  发布在  iOS
关注(0)|答案(2)|浏览(81)

我创建了一个名为myB2CDemonstration的B2C示例,并在那里创建了一个名为B2C_1A-SIGNUP_SIGNIN的体验框架流。
我的代码如下所示:

let kClientID = "d7628 ... 4a34d"
let kGraphEndpoint = "https://graph.microsoft.com/"
let kAuthority1 = "https://login.microsoftonline.com/7fb6a ... 427"
let kAuthority2 = "https://myB2CDemonstration.b2clogin.com/myB2CDemonstration.onmicrosoft.com/B2C_1A_SIGNUP_SIGNIN"
let kAuthority3 = "https://myB2CDemonstration.onmicrosoft.com/7fb6a ... 427"
let kRedirectUri = "msauth.br.com.edenred.ticket://auth"

let kAuthority = kAuthority1 // or 2 or 3

guard let authorityURL = URL(string: kAuthority) else {
      self.updateLogging(text: "Unable to create authority URL")
      return
  }
  
  let authority = try MSALAADAuthority(url: authorityURL)
  
  let msalConfiguration = MSALPublicClientApplicationConfig(clientId: kClientID,
                                                            redirectUri: kRedirectUri,
                                                            authority: authority)
  msalConfiguration.knownAuthorities = [authority]
  self.applicationContext = try MSALPublicClientApplication(configuration: msalConfiguration)
  self.initWebViewParams()

如果使用kAuthority1kAuthority2,则会出现错误
无法获取令牌:错误域= MSALErr域代码= -50000用户信息= {MSALErr描述密钥= AADSTS50049:未知或无效的示例。MSALOAutherrorKey = invalid_instance,MSALInternalErrorCodeKey = -42010}(以及一组跟踪ID、相关ID等)
如果使用kAuthority3,则会出现错误
无法完成该操作。(MSIDErrorDomain错误-51112.)TID = 3929455 MSAL 1.2.5 iOS Sim 16.2 [2023 - 01 - 05 20:48:01]创建错误描述:正在尝试使用B2C颁发机构URL初始化AAD颁发机构。
谁能告诉我我做错了什么?

fbcarpbf

fbcarpbf2#

其实我自己也有:我将MSALAADAuthority更改为MSALB2CAuthority,删除了作用域,并使用了变体2(使用租户名称,没有GUID)

相关问题