use of com.azure.identity.InteractiveBrowserCredential in project msgraph-sdk-java-core by microsoftgraph.
the class InteractiveBrowserMain method main.
public static void main(String[] args) throws Exception {
final InteractiveBrowserCredential interactiveBrowserCredential = new InteractiveBrowserCredentialBuilder().clientId(CLIENT_ID).redirectUrl("http://localhost:8765").build();
final TokenCredentialAuthProvider tokenCredentialAuthProvider = new TokenCredentialAuthProvider(SCOPES, interactiveBrowserCredential);
final OkHttpClient httpClient = HttpClients.createDefault(tokenCredentialAuthProvider);
final Request request = new Request.Builder().url("https://graph.microsoft.com/v1.0/me/").build();
httpClient.newCall(request).enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) throws IOException {
System.out.println(response.body().string());
}
@Override
public void onFailure(Call call, IOException e) {
e.printStackTrace();
}
});
}
Aggregations