Purpose:
The library automatically manages all the user OAuth mechanisms between the users and your apps. The Identity class will:
- Read and use all the configuration done and needed for your site, such as API endpoints, credentials…
- Ensure the library always have an client token valid and not expired to perform other calls
- Check whether the access token (user token) is valid or not and not expired
- Refresh the tokens in case of expired
- Exchange shared sessions to obtain Single Sign On
- Optimize API calls using caches
All these OAuth 2 authorization and autentication mechanisms are proudly resumed for your easyness in Identity::isConnected(); method.
Example: check if the user is connected
The Identity class manages the login status of the user. As soon as the Identity class is initiated with Identity::init(); you can invoke it.
1 |
<?php if (Identity::isConnected()) echo "Im logged!!"; ?> |
Complete example
Find below how your entire page should appear. The example is consulting whether the user is connected or not.