The normal way of authenticating users in Cryptolens is through license keys. However, there is another way. You can choose to allow customers to use username and password authentication. This blog focuses on how this method works in theory. Please visit the full documentation page if you want to learn about the code implementation. We have also made the following video tutorial which features code examples in Python:
Username and Password Authentication
There are some use cases where it might be more convenient to authenticate users with a username and password as opposed to a traditional license key. If a customer has a lot of licenses, or if you offer your application both as a web and desktop service, username and password authentication would be a suitable approach.
Step 1 – Access Token Permissions
In Cryptolens, the first step to implement username and password authentication is to select the correct access token permissions. In the “Miscellaneous” section of the access token permissions page, you will find “User Auth Normal” and “User Auth Admin”. It is recommended to use the “User Auth Normal” for the client code. However, in your back-end where you will create new user accounts, the permission “User Auth Admin” is more suitable.
Step 2 – User Creation
In your code, you need to implement a way for customers to sign up and choose a username, password, and alternatively, an email address. This is also where you can assign a customer ID. Please watch the video above or the full implementation page for code examples on how to set this up. After a user has successfully registered, they will appear in the Cryptolens dashboard and be assigned to a Cryptolens customer.
Step 3 – Authenticating Users
Because the user account that was just created is associated with a Cryptolens customer, you will be able to retrieve all of their Cryptolens license keys when they log in. You will also get the license properties such as the features, notes, product ID, and more. From this point, you will be able to proceed with key verification as normal. Once again, please check the full documentation page for code examples and a more detailed guide.
Thank you for reading, please reach out to us if you have any questions!