3

How can I get a Microsoft graph refresh token using java SDK? I am using java SDK of graph and got the access token. How can I get a refresh token in java SDK using this accessToken?

4
  • 2
    Does this answer your question? How to refresh a token for Microsoft Graph Commented Jan 3, 2020 at 13:16
  • No. I am using Java SDK. Let's say i have got a graphClient initialized using the access token. Now the token will surely expire after 59 minutes.According to this initialized graphclient should stop working. How can I get the refresh token or update graphclient in Java SDK Commented Jan 4, 2020 at 6:22
  • Or is it like if "once graphclient is initialized using access token you can use it as long as you want without any need to re-initialize it." Commented Jan 4, 2020 at 10:02
  • answer stackoverflow.com/a/51161027/12396017 describes the use of grant type REFRESH TOKEN and SDK contains method which does such thing - com.microsoft.graph.auth.BaseAuthentication -> getAccessTokenSilent() -> setGrantType(GrantType.REFRESH_TOKEN) - I vote to close this question as an duplicate Commented Jan 5, 2020 at 4:33

1 Answer 1

1

For Client credential flow, you don't get the refresh token. You can simply request a new access token again. A better idea will be to use https://github.com/microsoftgraph/msgraph-sdk-java-auth for auto-refresh of access token which will save you a lot of programming efforts

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.