Learn how the login feature works in your Canvas app
The Canvas platform allows you to configure a page of your website to be used as the login screen of your app. The login screen has a unique behavior, as it will reload the app and be dismissed after a successful login.
The reload is important in most cases so the content can be updated, displaying specific elements in their logged-in state.
Note that you can configure the login screen in two different ways:
- On app start: in this case, the login screen will be displayed as soon as your app is opened, requiring users to log in before they can access the content of your app
- Inside your app: the login screen will be triggered as soon as the user clicks a button or link that matches the URL used as the “Login URL” in your configuration
The user authentication is controlled exclusively by your website, meaning that the user will be providing his website username and password, and your website will be responsible for validating that information.
What happens after the successful login is what matters to the app, as it will use that information to determine if the login screen should be dismissed and the app should be reloaded.
Successful login in the app
The app needs to know that a user has been successfully logged in, so it can dismiss itself and reload the content. There are a few different ways of doing that:
When using the WordPress login method the app will communicate with our WordPress Plugin called MobiLoud Canvas, and automatically identify the logged-in user.
The cookie name login method is the most reliable option for all websites outside of the WordPress space. The app will look for a specific cookie when a URL redirect is triggered in the login screen, and if that cookie is in place after the redirect it will consider the user logged in.
You can find more details on how to set this up clicking here.
In case you don’t have control over the cookies of your website, you can use the URL matching option. When enabled, the app will be looking for a specific URL on the login screen, when that URL is loaded it will consider the user logged-in.
The URL can look like this: https://yourwebsite.com/login-successful