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?
-
2Does this answer your question? How to refresh a token for Microsoft GraphMaxim Sagaydachny– Maxim Sagaydachny2020-01-03 13:16:11 +00:00Commented 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 SDKUser1290– User12902020-01-04 06:22:53 +00:00Commented 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."User1290– User12902020-01-04 10:02:20 +00:00Commented 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 duplicateMaxim Sagaydachny– Maxim Sagaydachny2020-01-05 04:33:47 +00:00Commented Jan 5, 2020 at 4:33
Add a comment
|
1 Answer
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