User's Licences

Is there a way to determine all licenses owned by a user, together with allowed activations and total activations? Or, do you have to “List all licences” and filter by userid.
Similarly to get the userid for a user do you have to list all users and find by email address, assuming they don’t have multiple users with same email. Can you get the userid from username and password?

In fact, what is the username. When creating a user in the dashboard, first and last name , email and password only are required but no username is set. What will get GetLicenseUserName (StringBuilder name, int length) in Lexactivator.cs return for example. The new dashboard in version 3 is great and Web API page a great help, but just trying to understand how everything fits together and how to best integrate into my application.

Hi Vil,

There are two ways to list all licenses owned by a user, depending on who is fetching the license.

If you want the user to fetch its own licenses (say in the app itself), you can authenticate the user using its own credentials:

https://docs.cryptlex.com/user-management/authenticating-users

and then use the access token to invoke following endpoint:

https://api.cryptlex.com/v3/docs#operation/V3AccountsLicensesGet

Alternatively, you can filter the v3/licenses using userId.

To get the user id, either authenticate using user credentials and then invoke:

https://api.cryptlex.com/v3/docs#operation/V3AccountsProfileGet

The access token you retrieve after authentication is a JWT and also contains user id in “sub” claim.

You can also filter v3/users using email (guaranteed to be unique) to the user details.

GetLicenseUserName() is actually - get license user’s name. In the user resource,

https://api.cryptlex.com/v3/docs#operation/V3UsersByIdGet

you have a name property which is simply first name + last name.

I am a little confused as Authenticating user has the required parameter CompanyID which I needed to set as Account holder of the dashboard and not as a user. The retrieve licences is in the Accounts section of web API, and assume if I authenticate with my companyid, email, password and invoke
https://api.cryptlex.com/v3/docs#operation/V3AccountsLicensesGet
Would it list all licenses in the system rather than that of an individual user? Am I missing something?
Also where is the customer portal referred to in
https://docs.cryptlex.com/user-management/authenticating-users
Thanks

Each access token contains the user id for which the token was issued. So if you invoke /v3/accounts/licenses it will fetch the licenses which were linked with the current user.

To get all the licenses you only need to GET /v3/licenses

Your customers can also log into the dashboard, just create a user, associate it with a license, and try logging in with the same credentials and you can see licenses for the user.

To log in to the dashboard you need a CompanyID
You also need a CompanyID to Authenticate a user and get an access token
CompanyID is not required to set up a user. It only requires First and Last Name ,email and password
How can you authenticate a user or log in to the dashboard without a CompanyID???
Am I missing something?

Suppose Comapany1 and Company2 have accounts with us and use Cryptlex for licensing. Suppose Customer1 buys products from Company1 and Company2 with the same email id.

Now in order to check his licenses for the product he bought from Company1, he must provide company id too other than email and password because email is common and not enough to differentiate.

Cryptlex is by default multi-tenant, the same email can exist with different company id’s.

“CompanyID is not required to set up a user. It only requires First and Last Name ,email and password”?

To setup a user you need to be logged in or provide access token (if using web API). Each access token contains the company id, so that is not needed if the request contains the access token.

company id is only required for non-authenticated requests, i.e. the requests which don’t have access token in the authorization header.

The whole time I have asked about the customer/user level
As a customer with a first name, last name, Email and password ONLY, how do I log on to the dashboard?
Thanks

You need to provide your customers with the company id, so that they can login.

Usually, companies create their own customer portals (for branding purpose) using the Cryptlex Web API, in that case, they hard code the company id in the login form.

Thank you