我已经为 ADAL 认证设置了一个演示应用程序。我们公司要求安装 InTune 应用:
https://itunes.apple.com/us/app/intune-company-portal/id719171358?mt=8在安装和设置 InTune 后,我安装了我开发的 ADAL 演示应用程序:
added ADAL as Pod Library
added redirect URI inside my Azure Portal (https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps) (one with schema://bundle_id and one with msauth://code/schema%3A%2F%2Fbundle_id)
added to app's info.plist:
<key>LSApplicationQueriesSchemes</key> <array> <string>msauth</string> </array>
4.加入到应用程序的info.plist文件中
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>bundle_id</string>
<key>CFBundleURLSchemes</key>
<array>
<string>schema</string>
</array>
</dict>
</array>
added
[_authContext setCredentialsType:AD_CREDENTIALS_AUTO];
to use inTune App Portal for broker auth.create the authentication with:
ADAuthenticationError *error = nil; _authContext = [ADAuthenticationContext authenticationContextWithAuthority:@"https://login.microsoftonline.com/common" error:&error]; [_authContext setCredentialsType:AD_CREDENTIALS_AUTO]; [_authContext acquireTokenWithResource:@"https://graph.microsoft.com" clientId:@"my_client_id" // Comes from App Portal redirectUri:[NSURL URLWithString:@"schema://bundle_id"] // Comes from App Portal completionBlock:^(ADAuthenticationResult *result) { NSLog(result.accessToken); }];