Store CdsServiceClient between application restarts? #90
-
Is it possible to store the CdsServiceClient so the user does not need to authenticate every time he starts the application? Using the following code I am able to connect:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can serialize token and store it in some kind of persistent storage (file, DB, etc). Anyway token has lifetime which usually less than 24h. So if I logged in successfully today. Tomorrow by the time I will relaunch the app, the token will expire and I would have to enter credentials anyway. |
Beta Was this translation helpful? Give feedback.
You can serialize token and store it in some kind of persistent storage (file, DB, etc).
Next initialize new CdsServiceClient instance with injecting token provider function which will deserialize it:
public CdsServiceClient(Uri instanceUrl, Func<string, Task<string>> tokenProviderFunction, bool useUniqueInstance = true)
Anyway token has lifetime which usually less than 24h. So if I logged in successfully today. Tomorrow by the time I will relaunch the app, the token will expire and I would have to enter credentials anyway.