Home > Blockchain >  Can I srore email & password on my class code not database for jwt token generate
Can I srore email & password on my class code not database for jwt token generate

Time:06-11

I want to store my credintial like email and password hardcode on my code, when I create jwt token then I want to use it. Can I do this??

If it possible how to access email and password.

CodePudding user response:

First of all you can use credentials class and some collection of them in memory. Secondly, you can use database

But: It is in general not recommended to store the user's password anywhere without encryption

Example: User -> [email protected], Password -> qwerty123 must be stored as: [email protected] and pass as awofi12312ASOIFDAOSF@?@?"!£!". No matter where: in memory, in db.

For usage you must also implement decryption in order to check credentials from encrypted value to it's decrypted state (from -> awofi12312ASOIFDAOSF@?@?"!£!" to -> qwerty123)

CodePudding user response:

You can use the settings file to overcome this problem. Go to the Add New Item window and select the settings file. Then it will open a table and put "email" and "password" to identify the references. And also you need to select the data type and if you want to add a default value, you can add that one here too.

So you can read data by this line,

bool dataSaved = savedSetting.Default.dataSaved;

And also you can write data by this code,

savedSetting.Default.dataSaved = true;
            savedSetting.Default.Save();
  • Related