Cookie-based login

The cookie-based login method is the easiest approach for enabling login on your Canvas app.

On most websites, when a user goes through the authentication process, a cookie is generated and stored on the browser. That cookie holds a token, which is then used by the website to revalidate the user login without having to ask for the username and password to be provided again.

Canvas allows you to use that cookie to determine if the user is logged in or not.

⚠️
IMPORTANT! Canvas doesn't authenticate or validate the user login, it simply uses the cookie to determine if the user is logged in or not, dismissing the login screen if necessary.

On every request performed by the app, a check with be performed against the cookies on the page being requested, if the selected cookie name is present, the user will be considered logged in.

To enable the cookie-based login the first step is to set the "login_method" parameter in your Canvas configuration to "cookie_name". The “cookie_name” parameter must be added inside the “Login” options, as you can see below:

Notion image

You will now need to set up the "Cookie_Name_Regex" parameter with your cookie name. This is a regex field, meaning that the app will look for a cookie name that matches the rules defined in this field.

Notion image

If your cookie name is "logged_in" you can use "logged_in" as the value. If your cookie name uses random strings, like "logged_in_123456" where the number is always different for each user, you can use "user_logged_in_.*" as the value.

Defining the cookie name when you are the website developer is easy, but if you need assistance with identifying the name of your login cookie, see our guide on how to find your login cookie name.

Now that you have configured your cookie-based login in the app, you will want to make sure everything works as expected.

Whenever the app identifies a successful login, it will display your app splash screen, with a message at the top ("Logged-in successfully, redirecting..."), for a very brief period and then will take the user to the content. If you are not seeing the splash screen after the login you might want to review your regex and app configuration to make sure everything has been properly configured.

Did this answer your question?
😞
😐
🤩