Loc Dai Le
Loc Dai Le

Reputation: 1697

How to save an accessToken in C# WPF application

I'm making an WPF application where I have user login. I don't have my own database but i use an rest api to get the needed data. When I login i get an accesstoken. This token is need to get data for the specific user. Right now i save the accesstoken in a static variable, but when I close the app the accesstoken is not saved anymore. Is there a way to save this accesstoken without a database and without to save it in a local file. I use to save in session when I'm developing web apps. Is there a similar way in C# WPF.

Upvotes: 3

Views: 4323

Answers (2)

Dennis
Dennis

Reputation: 37780

Desktop applications can use user settings to save data between launches.
Eventually settings will be stored in a local file, but there is convenient API to access them.

Upvotes: 2

Speedy Codezales
Speedy Codezales

Reputation: 326

I don't think its possible to do this without using any local files. User/app settings will always use a file somewhere on your machine.

In Web apps your session data is also saved in a file somewhere on your system (user appdata usually).

If you don't want to save it in a file because of security reasons, you could just encrypt it.

Upvotes: 1

Related Questions