Steps to get up and running (Type 2 integration)
This section will be walk you through in detail how to start with the type 2 integration
- Make sure you have a Spintly account created for you, if account is not created please contact our sales team(sales@spintly.com)
- Once the account is created, make sure you have you have signedup and logged in to spintly dashboard
3) Next thing is to obtain the spintly clientid, clientSecret, as of now this feature of getting clientid.clientsecret is not available in spintly dashboard, please go to the spintly help and support and request for the clinetid and clientsecret for you account (https://smart-access.spintly.com/dashboard/help-and-support) . Also request for the postman collection of all the apis available(this feature of getting postman collection also will be available in the dashboard)
4) Once you have obtain the postman collection and clientid, clientsecret, make sure you download postman and import the postman collection shared (go to file> import and upload the postman collection shared)
5) In the postman collection uploaded, go to the ouath token part, put the clientid and clientsecret and click send
6) Copy the token, go to create user api, for createing user you will need few things from spintly, that is the homesite, rolesid ie which role the user needs to get assigned and finaly the access pointids, so
for homesiteid, you need to call the sites api to get the siteid https://saams.api.spintly.com/organisationManagement/v2/integrator/organisations/orgid/sites
for access pointids, you need to call the access points api https://saams.api.spintly.com/organisationManagement/v1/integrator/organisations/orgid/sites/siteid/accessPoints/list
for roleids you need to call the formdata api https://saams.api.spintly.com/userManagement/integrator/v1/organisations/orgid/formData?roles=roles
7) Now that you got the roleid, siteid and access pointid, next you can call create user api
8) You can verify the user if it is created, by going to user management section of the dashboard (https://smart-access.spintly.com/dashboard/allusers)
9) You can verify the user if it is created, by going to user management section of the dashboard (https://smart-access.spintly.com/dashboard/allusers)
10) Next you have to create the token using the program spintly has given in point 2(eventually once the poc is done, the creation of tokens the client has to handle in its backend), currently spintly has created its own private key for the client to generate the token.
Below is how a token is generated in nodejs, as you can the sub is same as the userid, mention in point 6
And once you decode the token, it looks like something like below
11) Next install the spintly sample app which was provided in point 2, once you install the sample app, make sure you insert the Mobile clientId, mobile provider id from point 2 and also token generated in point 10. Here region will be "in" if it is india or “us” if it is united states, env will be either stage1 or prod depending on the enviroment
12) Once the above details are put, click on login, once logged in you will see all the access points assigned to you, you can ciick on the access point shown in the ui or you can tap the phone on the reader
13) Once the user has done access, the person access history will be shown in the dashboard