Hi Shinoy,
Thanks for posting the question in the forum.
First of all, I'm sorry for the out-dated documentation; I will work on updating those documentation with the latest and relevant contents soon.
For Authorization Code flow, the first thing that you will have to keep in mind is the following:
1) Implicit Authentication: This is a flow where Mobile SDK invokes callback block implemented by developers to acquire user credentials (in this case Authorization Code) when there is no credentials (i.e. not authenticated status, or all tokens expired). In this scenario, app developers need to implement the callback block, and handle the flow accordingly, and Mobile SDK will invoke the block at any time when it's necessary. Note: This callback block will only be triggered when Grant Flow of SDK is set to Password.
- For more details of Implicit Authentication, you will simply have to implement the following callback block to handle the implicit authentication flow:
[MAS setUserAuthCredentials:^(MASAuthCredentialsBlock authCredentialBlock) {
MASAuthCredentialsPassword *credentials = [MASAuthCredentialsPassword initWithUsername:"username" password:"password"]; //or
MASAuthCredentialsAuthorizationCode *credentials = [MASAuthCredentialsAuthorizationCode initWithAuthorizationCode:"code"];
authCredentialBlock(credentials, NO, ^(BOOL completed, NSError *error) {
//
// Handle the result of authentication with above credentials
//
});
}];
2) Explicit Authentication: This is a flow where app developer explicitly call to authenticate the session. Simply, app developer calls [MASUser login..] method to authenticate the user with any choice of credentials.
Keeping that in mind, the workflow of getting the authorization code from Mobile SDK is following:
1) (For Social Login) Make sure all server configurations are done correctly. Simply you can check with MAG Manager of the gateway, and try to login with any authentication providers you would like to perform.
2) Retrieving Authentication URL from Mobile SDK.
- This will be done automatically for Implicit Authentication; within the callback block, the authentication URL will be prepared, and available to use. Simply use [MASAuthenticationProviders currentProviders] to retrieve an array of authentication URLs
- For Explicit Authentication, you will have to fetch the authentication URLs by yourself. Simply call [MASAuthenticationProviders retrieveAuthenticationProvidersWithCompletion..] method to retrieve the authentication URLs.
3) For Authorization Code flow, there are two possible features in Mobile SDK,
- Proximity Login (using QR Code, or BLE), or
- Social Login
4) Once you obtain the authorization code from either of features, you can simply hand that auth code back to Mobile SDK to proceed authentication.
For Proximity Login, please refer to iOS Guides | CA Mobile App Services
For Social Login, please refer to iOS Guides | CA Mobile App Services
Hope this helped, and please let me know if you need any further assistance on this issue.
If you could please specify bit more on which use case you would like to use, that would help me a lot to narrow down, and focus on exactly what you would like to try and more specific examples with Mobile SDK.
Thanks,