Get Started
Before you can integrate our service, at least you have an account in Autz.org.
Login
- Click "Login/Register" button on top of this page.
- Follow the step until you manage to see the dashboard.
- Go to "Account" menu, click "Activate Developer Mode"
- Fill all the fields and then submit. You'll see new menu called "App"
Create App
- Go to "App" menu.
- Click "Create New" button, and fill the form.
- Fill the Callback Origin with your origin (you can add it later). Let's say
http://localhost:3000
. - Once you hit "Save" button, your app will be listed on the page.
- Click the App name and you will see the App ID. We'll use it in the next section.
Integration
Update your database
Add a column to your users table in your database called autzorg_id
, string (36 chars).
Create authorization page/endpoint
- Create an HTML page or just a GET endpoint (Callback URL). Let's say
http://localhost:3000/authorize_autzorg
. - If any request come to the page/endpoint, you will need to capture the
auth_code
from query string. - Call the UserInfo API to get the user information (UserData). Then you can use it to authenticate the user.
UserInfo API
Endpoint (GET method):
https://autz.org/api/client/{your-app-id}/userinfo?code={auth_code}
Response (UserData):
{
"user": {
"id": "a7ivjqiq",
"name": "John Doe",
"email": "[email protected]",
"phone": "+62-89123456678",
"address": "123 Maple Street. Anytown, PA 17101",
"gender": "male",
"dob": "1990-02-14"
}
}
Create Login button
Create a button/link that will redirect the user to the Onboarding link below.
https://autz.org/onboarding/{your-app-id}?callback_url=http://localhost:3000/authorize_autzorg
Authenticate User
After you get the UserData, now you need to authenticate your user.
Find or create User
- Get the id from UserData (e.g.
a7ivjqiq
) then query to your DB. Find the user whereautzorg_id
= "a7ivjqiq". - If it doesn't exist, then create a user with
autzorg_id
= "a7ivjqiq". You may also save all of information from UserData to your users table. - Now, you have the user (John).
Login mechanism
After you have the User (existing/new), you can log the user in based on your app mechanism.
- If your app is using JWT, then generate the JWT for John.
- If you use a stateful web framework (e.g. Laravel, AdonisJS, etc), you can just login with the id of John.
- If your app is using cookie, then just generate the cookie for John.
Examples
There are three repositories you can check to see how the Autz.org implementation works