Setup
Contact your loyale administrator in order to obtain the Scheme ID and your POS Credentials
You should save these details on your website server-side for use with our API requests in the next steps.
At the end of your site body include the Loyale SSO library and call the loyalesso function.
<script src="https://web.loyale.io/loyale-sso-1.1.js"></script>
<script>
loyalesso({
schemeId: 'scheme_id',
successUrl:'success_url',
errorUrl: 'error_url',
fields: 0,
environment: 'env_name'
});
</script>
The function accepts the following settings
Parmeter | Value | Description | Required |
---|---|---|---|
schemeId | string: The scheme id of your loyale scheme | This can be found in loyale backoffice under Scheme Settings | Yes |
successUrl | string: The success url for redirection | This is where the sso will redirect on successfull authentication of the customer | Yes |
errorUrl | string: The error url for redirection | This is were the sso will redirect on failure to authenticate the customers | Yes |
fields | enum: The fields required by the site | By default the basic fields will always be required by loyale, but if you require personal details such as gender or date of birth you can pass 0, if you require the address details you can pass 1, if you want both you can pass 2 | No |
environment | string: Environment name | The environtment on which to run the sso, either 'staging' or 'producton'. If left empty production environtment will be used | No |
Finally include the HTML placeholder tag wherever you want the 'Sign in with Loyale' button to appear.
<div data-loyale-sso></div>
<div data-loyale-sso data-loyale-other="userId_12345678"></div>
<div data-loyale-sso data-loyale-user='{"email":"[email protected]","firstName":"John","lastName":"Doe"}'></div>
Each tag can also pass its own unique data, via specific attributes.
Attribute | Value | Description | Required |
---|---|---|---|
loyale-other | string | Any string data that you want to receive back in the success or error callback | No |
loyale-user | string: stringified json | A strigified json object of the user data you have. Currently this accetps the properties email, firstName and lastName | No |
This will load the Loyale SSO button like the example below
Updated over 2 years ago
What’s Next