Skip to main content
Version: 2.0.0

Connect Your App

Congratulations! You have succesfully set up an RBAC Policy!

All you have left to do is to follow the instructions on your screen to connect Permit into your application.

Remember that once you connect your app to Permit, you will need to run your application locally and navigate to localhost:4000 to see the results.

Onboarding Introduction

Integrate Permit into your own application

To integrate Permit.io into your own application, you can use the Permit SDK or work with the API directly.

Let's say that you have a web app that uses the Permit SDK to check for permissions. In the app, each user that signs in should have a unique identifier - such as:

  • user-id
  • email
  • Auth0Id
  • CognitoId

Your user object probably looks something like the one below (an example from Auth0):

Example user object

{
"user": {
"id": "abc123livrjeoigv",
"tenant": "my-tenant",
"username": "user1",
"password": "xxxxxxx",
"email": "user1@foo.com",
"first_name": "John",
"last_name": "Smith",
"emailVerified": true
}
}

Sync user

This SDK function is used to sync a user's data with the Permit.io PDP upon the users creation.

note

Once the user has been synced with Permit, you should not use this API call anymore to update the user's Role. Use assignRole instead.

UserKey userObj = new UserKey(user.id, user.first_name, user.last_name, user.email);
permit.Api.SyncUser(userObj);

Assign user

To update a user's role after a user has been synced/created, you can use the following function.

assignedRole = await permit.Api.AssignRole(user.customId, Role.id, Tenant.externalId);

List roles

To get the available roles, you can use the following function:

Role[] roles = await permit.Api.GetRoles();

Manage resources

To sync your resources and actions you can use our Web Application.

Or you can use the SyncResources SDK function that you can find under the relevant language, in the SDK navigation panel.


List tenants

To get the available tenants, you can use the following API Call.