我创建了一个名为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()
如果使用kAuthority1
或kAuthority2
,则会出现错误
无法获取令牌:错误域= 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颁发机构。
谁能告诉我我做错了什么?
2条答案
按热度按时间jjhzyzn01#
尝试此处的示例,您似乎正在使用AAD示例。https://learn.microsoft.com/en-us/azure/active-directory-b2c/configure-authentication-sample-ios-app
fbcarpbf2#
其实我自己也有:我将
MSALAADAuthority
更改为MSALB2CAuthority
,删除了作用域,并使用了变体2(使用租户名称,没有GUID)