Azure-Samples / Azure-Samples/ms-identity-msal-java-samples

Wondering if we need to update the sample code

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
untriaged
Dominant language
Java
Stars
79
Forks
82
PR merge metrics
No merged PRs in 30d

Description

https://github.com/Azure-Samples/ms-identity-msal-java-samples/blob/9c173abaa9643d8d4b5e5507196f7b3c33a5688b/3.%20Java%20Servlet%20Web%20App%20Tutorial/2-Authorization-I/call-graph/src/main/java/com/microsoft/azuresamples/msal4j/helpers/GraphHelper.java#L46

I followed this pattern in my code and I'm facing an issue where I got the "java.net.SocketTimeoutException: Read timed out" exception, then I google the issue, somebody from Microsoft suggested this way

```
public static GraphServiceClient getGraphClient(String accessToken, boolean force) throws ClientException {
if (client == null || force) {
client = GraphServiceClient.builder()
.authenticationProvider(new MsalGraphAuthenticationProvider(accessToken))
.buildClient();
}

return client;
}
```

Basically create few clients as less as we can, but I still got that exception constantly.

Any thoughts as to how to resolve this exception?
Thanks!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked GraphHelper.java entry point around line 46 and compare its client construction with the suggested GraphServiceClient pattern. Reproduce the java.net.SocketTimeoutException: Read timed out, then determine whether the sample needs an update or whether the issue requires separate usage guidance; done means the cause and resolution are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.