Skip to content

Wondering if we need to update the sample code #4

@xipeter

Description

@xipeter

return GraphServiceClient.builder().authenticationProvider(new MsalGraphAuthenticationProvider(contextAdapter))

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<Request> 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions