简体   繁体   中英

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM