Concurrent use not accounted for in authentication providers
The sdk could easily be in use from multiple threads in an application. To keep new token requests to a minimum one approach is simply to add a synchronized keyword to UsernamePasswordProvider.getAccessToken() and other other providers in this project.
AB#7115
Thank you @davidmoten. We are adding this to our backlog to be considered when we have resources focused on this again.
Hi @davidmoten Thanks for reaching out and for the patience. With the release of the v3 of the java SDK, it now integrates with Azure Identity which supports a wide variety of authentication flows out of the box. We strongly encourage you to migrate to this v3 + azure identity, and you can read more about it in this issue. https://github.com/microsoftgraph/msgraph-sdk-java/issues/628
This issue won't be fixed, but I'll leave it open for visibility, and the repository will be archived soon.