Developer Guide

Get Started

Before you can integrate our service, at least you have an account in Kunber.

Login

  1. Click "Login/Register" button on top of this page.
  2. Follow the step until you manage to see the dashboard.

Create App

  1. Go to "App" menu.
  2. Click "Create New" button, and fill the form.
  3. Fill the callback URL with your origin. Let's say http://localhost:3000.
  4. Once you hit "Save" button, your app will be listed on the page.
  5. Click the App name and you will see the App ID and App Secret. We'll use them in the next section.

Integration

Update your database

Add a column to your users table in your database called kunber_id, string (36 chars).

Create authorization page/endpoint

  1. Create an HTML page or just a GET endpoint (Callback URL). Let's say http://localhost:3000/authorize_kunber.
  2. If any request come to the page/endpoint, you will need to capture the auth_code from query string.
  3. Send http POST request to our system (Exchange API). See CURL below.
  4. Get the user information from the response (UserData). Then you can use it to authenticate the user.
CURL -L -X POST 'https://kunber.zone.id/api/client/{your-app-id}/exchange' \
  -H 'Authorization: your-app-secret' \
  -H 'Content-Type: application/json' \
  --data-raw '{"code": "the_auth_code_goes_here"}'

Create Login button

Create a button/link that will redirect the user to the Onboarding link below.

https://kunber.zone.id/onboarding/{your-app-id}?callback_url=http://localhost:3000/authorize_kunber

Authenticate User

After you get the UserData, now you need to authenticate your user.

Find or create User

  1. Get the id from UserData (e.g. user-1234) then query to your DB. Find the user where kunber_id = "user-1234".
  2. If it doesn't exist, then create a user with kunber_id = "user-1234". You may also save all of information from UserData to your users table.
  3. Now, you have the user (e.g. John).

Login mechanism

After you have the User (existing/new), you can log the user in based on your app mecahnism.

  • 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 two repositories you can check to see how the Kunber implementation works

Last updated: 2025-02-23
Kunber

Kunber is one of PT. Geksa non-profit projects.

We developed this service to make developing software easier. Especially in the authentication parts.