Hi @vlad5
Thank you for the additional info on the matter.
Indeed, the documentation for Auth0 Lock appears to be quite scarce.
From your initial post, I understand that you want to load your page regardless if an user is authenticated or not. Since checkSession()
method allows you to acquire a new token from Auth0 for a user who is already authenticated against Auth0 for your domain you receive an error if they are unauthenticated. For this, you could handle the error then redirect the user to the page. An example on using the checkSession()
is available in the Github documentation.
lock.checkSession({}, function (error, authResult) {
if (error || !authResult) {
lock.show();
} else {
// user has an active session, so we can use the accessToken directly.
lock.getUserInfo(authResult.accessToken, function (error, profile) {
console.log(error, profile);
});
}
});
You can read more about checkSession()
in the Github Documentation for Auth0 Lock. The documentation also reference our documentation for using checkSession()
to Receive a New Token.
Also, you can check this community post regarding a similar issue as the one you are experiencing.
If your implementation is similar to the one provided above and the following documentation was not helpful, could you post a snippet of your implementation and of your checkSession()
function to take a look?
Kind Regards,
Nik