Visual Studio Mobile Center

Identity

Add Identity to your mobile app with either client flow (recommended) or server flow authentication after adding Azure Android SDK to your mobile app.

Client flow

  1. Install the provider client SDK by following its instructions:
  2. On log in completion with the client SDK, make sure Azure gets the authentication token by adding the following snippets:

Azure Active Directory

val providerToken = new HashMap[String, String](){
    put("access_token", result.getAccessToken())
]
azureMobileClient.login("aad", providerToken, optionalCallback);

Facebook

val providerToken = new HashMap[String, String](){
    put("access_token", AccessToken.getCurrentAccessToken().accessToken)
]
azureMobileClient.login("facebook", providerToken, optionalCallback);

Google

GoogleSignInAccount acct = result.getSignInAccount();
val providerToken = new HashMap[String, String](){
    put("id_token", acct.getIdToken())
]
azureMobileClient.login("google", providerToken, optionalCallback);

Microsoft Acount

val providerToken = new HashMap[String, String](){
    put("authenticationToken", liveClient.getSession().getAuthenticationToken())
]
azureMobileClient.login("microsoftaccount", providerToken, optionalCallback);

Twitter

TwitterSession session = Twitter.getSessionManager().getActiveSession();
TwitterAuthToken authToken = session.getAuthToken();
val providerToken = new HashMap[String, String](){
    put("access_token", authToken.token)
]
azureMobileClient.login("twitter", providerToken, optionalCallback);

Server flow

  1. Add the server authentication call to your mobile app to authenticate users.
azureMobileClient.login("{provider}", optionalCallback);