gpt4 book ai didi

Azure AD ADAuthenticationError 15-unauthorized_client-此 API 版本不支持应用程序

转载 作者:行者123 更新时间:2023-12-02 07:12:45 26 4
gpt4 key购买 nike

我需要注册我的应用程序才能使用 Outlook 日历 API。我在这里创建了应用程序:https://apps.dev.microsoft.com 。我有应用程序 ID 和重定向 URI。然后我使用以下方法来获取 token :

[self.context acquireTokenWithResource:resourceID
clientId:clientID
redirectUri:redirectURI
completionBlock:^(ADAuthenticationResult *result) {
if (result.status !=AD_SUCCEEDED){
completion(result.error);
}

else{
self.accessToken = result.accessToken;
self.refreshToken = result.tokenCacheStoreItem.refreshToken;
self.familyName = result.tokenCacheStoreItem.userInformation.familyName;
self.givenName = result.tokenCacheStoreItem.userInformation.givenName;
self.userID = result.tokenCacheStoreItem.userInformation.userId;
completion(nil);
}
}];

并收到此错误:

Error with code: 15 Domain: ADAuthenticationErrorDomain ProtocolCode:unauthorized_client Details:AADSTS70001: Application '***' is not supported for this API version.
Trace ID: c5286e11-9fa9-4ddd-96a4-a29ddd6b416c
Correlation ID: c608d556-729b-4cad-80be-24d85f5558d4
Timestamp: 2016-03-14 13:05:11Z. Inner error details: Error Domain=ADAuthenticationErrorDomain Code=15 "The operation couldn’t be completed. (ADAuthenticationErrorDomain error 15.)"

请帮助我正确注册我的应用程序

更新:@dstrockis 帮助解决了这个问题。但现在我有了另外一个:有https://cocoapods.org/pods/ADALiOS使用方法

 [authContext acquireTokenWithResource:resourceId
clientId:clientId
redirectUri:redirectUri
completionBlock:^(ADAuthenticationResult *result) {
if (AD_SUCCEEDED != result.status){
// display error on the screen
[self showError:result.error.errorDetails];
}
else{
completionBlock(result.accessToken);
}
}];

但是 ADALiOS 库 3.0.0-pre3 不包含此方法。我尝试过使用

- (void)acquireTokenWithScopes:(NSArray*)scopes
additionalScopes:(NSArray*)additionalScopes
clientId:(NSString*)clientId
redirectUri:(NSURL*)redirectUri
identifier:(ADUserIdentifier*)identifier
promptBehavior:(ADPromptBehavior)promptBehavior
completionBlock:(ADAuthenticationCallback)completionBlock;

我收到以下错误:“代码错误:17 域:ADAuthenticationErrorDomain 协议(protocol)代码:(null) 详细信息:应用程序没有当前的 ViewController。内部错误详细信息:错误域=ADAuthenticationErrorDomain 代码=17 “操作无法”待完成。 (ADAuthenticationErrorDomain 错误 17。)“”。

最佳答案

您使用的 ADALiOS 库版本错误。为了使用 v2.0 端点(以及在 apps.dev.microsoft.com 注册的应用程序),您将需要使用 ADALiOS 库的预览版本 3.0.0-pre3。请参阅https://cocoapods.org/pods/ADALiOS 。有关 v2.0 端点的更多信息,请访问 aka.ms/aaddevv2。

关于Azure AD ADAuthenticationError 15-unauthorized_client-此 API 版本不支持应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36006792/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com