Default:
Client Name: Enter Client Name
Site ID: Enter Site ID
Secret Key: Enter Secret Key
Loyalty Implementation Instructions:
Creating Client Access Token:
Note: Use the library JWT.IO to authenticate your request.
The JWT (JSON Web Token) needs to be created by the consumer application using the below details.
- Header:
- alg: Algorithm used for JWT i.e. HS256
- typ: Token type i.e. JWT
- Payload:
- sub: Consumer name as agreed during integration discussion
- exp: Token expiry timestamp at UTC
- site_id: Annex Cloud site ID, which is assigned to API consumers.
- hmac: This will be HMACSHA256 for JSON objects using a shared secret. The JSON object will be the payload for POST/PATCH APIs and URL params for GET API
- Signature:
- JWT needs to be signed using a shared secret.
- HMACSHA256(base64urlencoded (header) + “.”+ base64urlencoded(payload), sharedsecret)
access_token: base64urlencoded(Header).base64urlencoded(Payload).Signature
(This should be passed as a Token in the code to display the Loyalty dashboard).
To Display Loyalty Dashboard:
- To display the loyalty dashboard, add the following code on the Loyalty dashboard page.
<div id="socialannex_dashboard"></div>
<script>
var siteID = 'Enter_Site_ID';
var sa_emailid = "USER_EMAIL";//pass logged in email
var sa_ secure_token = "TOKEN";//pass generated token in #2.1
var sa_uni = sa_uni || [];
sa_uni.push(['sa_pg', '5']);
(function() {
function sa_async_load() {
var sa = document.createElement('script');
sa.type = 'text/javascript';
sa.async = true;
sa.src = '//cdn.socialannex.com/partner/Enter_Site_ID/universal.js';
var sax = document.getElementsByTagName('script')[0];
sax.parentNode.insertBefore(sa, sax);
}
if (window.attachEvent) {
window.attachEvent('onload', sa_async_load);
} else {
window.addEventListener('load', sa_async_load, false);
}
})();
</script>Note:
- In the above code, replace Enter_Site_ID with the site id provided by the Annex Cloud (for development only) in the default section.
- Annex Cloud will provide a different site id for the production site.
- Pass the JWTtoken generated in the 2.1 section in the above code as a token.