Reputation: 11
Anyone worked on windows azure with iOS, and how to access the windows azure active directory ... Please help me this below topics what are the values i will set up this below mentioned topic in coding ...
WAAD_LOGIN_URL WAAD_DOMAIN WAAD_CLIENT_ID WAAD_REDIRECT_URI WAAD_RESOURCE WAAD_SERVICE_ENDPOINT
Please provide me the help thanks in advance :)
Upvotes: 1
Views: 612
Reputation: 149
You may want to check the open source github library for authentication: https://github.com/MSOpenTech/azure-activedirectory-library-for-ios. I am currently the main contributor, so feel free to ask me further questions on the library. The readme file will give you an idea on how to authenticate and start using the provided access token. Here is a sample code for obtaining access token. Keep in mind that access tokens are internally cached, so all you need is to call the acquireTokenWithResource below every time you need it, the library takes care of the authentication (asking user for credentials if needed) and leveraging refresh tokens over the OAuth 2.0 protocol.
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.
}
}];
Upvotes: 1