Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String tenantId = "************";
- String username = "***************";
- String password = "*************";
- String clientId = "**********";
- String resource = "***********";
- String userEmail = "**********";
- AuthenticationContext authContext = null;
- AuthenticationResult authResult = null;
- ExecutorService service = null;
- try
- {
- service = Executors.newFixedThreadPool( 1 );
- String url = "https://login.microsoftonline.com/" + tenantId + "/oauth2/authorize";
- authContext = new AuthenticationContext( url, false, service );
- Future<AuthenticationResult> future = authContext.acquireToken(
- resource,
- clientId,
- userEmail,
- password,
- null );
- authResult = future.get();
- }
- catch( Exception ex )
- {
- ex.printStackTrace();
- }
- public AuthenticationResult AcquireTokenByRefreshToken(
- string refreshToken,
- string clientId,
- string resource
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement