Skip to content

Instantly share code, notes, and snippets.

@mehdok
Created May 8, 2017 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mehdok/380f1c44069ad8248bd0eecb1d889d48 to your computer and use it in GitHub Desktop.
Save mehdok/380f1c44069ad8248bd0eecb1d889d48 to your computer and use it in GitHub Desktop.
Authentication with microsoft ADAL v2
getAuthenticationContext().acquireToken(
mContextActivity,
Constants.SCOPES.split(" "),
null,
Constants.CLIENT_ID,
Constants.REDIRECT_URI,
PromptBehavior.Auto,
new AuthenticationCallback<AuthenticationResult>() {
@Override
public void onSuccess(final AuthenticationResult authenticationResult) {
if (authenticationResult != null &&
authenticationResult.getStatus() ==
AuthenticationResult.AuthenticationStatus.Succeeded) {
dependencyResolver = new DefaultDependencyResolver(authenticationResult.getToken());
discoverServices();
}
}
@Override
public void onError(Exception t) {
Log.e("onError", "onError : " + t.getMessage());
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment