Skip to content

Instantly share code, notes, and snippets.

@levancho
Created October 10, 2023 20:38
Show Gist options
  • Save levancho/e43781e0e83b1699c390ea9ffadb1d61 to your computer and use it in GitHub Desktop.
Save levancho/e43781e0e83b1699c390ea9ffadb1d61 to your computer and use it in GitHub Desktop.
MSAL4j public
PublicClientApplication app = PublicClientApplication.builder("YOUR_CLIENT_ID")
.authority("https://login.microsoftonline.com/YOUR_TENANT_ID")
.build();
RefreshTokenParameters parameters = RefreshTokenParameters.builder(
Collections.singleton("YOUR_SCOPE"),
"YOUR_REFRESH_TOKEN")
.build();
Future<IAuthenticationResult> future = app.acquireToken(parameters);
IAuthenticationResult result = future.get();
String newAccessToken = result.accessToken();
System.out.println("New Access Token: " + newAccessToken);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment