1

任何人在 iOS 上使用 Windows azure,以及如何访问 Windows azure 活动目录......请帮助我下面的主题我将在编码中设置下面提到的主题的值是什么......

WAAD_LOGIN_URL WAAD_DOMAIN WAAD_CLIENT_ID WAAD_REDIRECT_URI WAAD_RESOURCE WAAD_SERVICE_ENDPOINT

请提前给我帮助谢谢:)

4

1 回答 1

1

您可能需要检查开源 github 库以进行身份​​验证:https ://github.com/MSOpenTech/azure-activedirectory-library-for-ios 。我目前是主要贡献者,所以请随时向我提出有关图书馆的更多问题。自述文件将让您了解如何进行身份验证并开始使用提供的访问令牌。这是获取访问令牌的示例代码。请记住,访问令牌是在内部缓存的,因此您只需在每次需要时调用下面的 acquireTokenWithResource,该库负责身份验证(如果需要,请用户提供凭据)并通过 OAuth 2.0 协议利用刷新令牌.

ADAuthenticationError *error;
authContext = [ADAuthenticationContext authenticationContextWithAuthority:authority
                                                                    error:&error];

NSURL *redirectUri = [NSURL URLWithString:redirectUriString];
[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{
        //Use result.accessToken to access any services.
    }
}];
于 2014-04-03T16:00:19.717 回答