Refreshing tokens #108
-
Hello! I’m trying to write a CLI tool that makes use of this SDK to query for events in the outlook calendar. So far I’m able to access the user’s events in the first run after interactive authentication with the browser or device code, using the provided examples in the documentation. However, it is not clear how I can re-use and refresh tokens if necessary upon second run? Please keep in mind this is a tool that will make a query and exit, clearing memory in the process. So the second time this is run it’ll need to re-authenticate which is far from ideal. Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @diogovieira, Unfortunately the Go version of the library does seem to support it yet (it's more recent). I'm going to suggest you reach out directly to them to inquire about the plans for the library to support it. |
Beta Was this translation helpful? Give feedback.
Hi @diogovieira,
Thanks for using the Go SDK and for reaching out.
Azure Identity, the library we're using under the covers to handle authentication, provides a TokenCachePersistenceOptions class/struct that you can assign to the credential (device code in your case) to get the library to handle token storage and retrieval in a secure way for you depending on the target OS. see this example in dotnet for the CLI we're building
Unfortunately the Go version of the library does seem to support it yet (it's more recent). I'm going to suggest you reach out directly to them to inquire about the plans for the library to support it.
The alternative would be to store the refresh token yourself, bu…