Skip to main content

Access Request

Embed the Access Request element so users who lack a role can request it from inside your application. This page is for developers who add Permit Elements, the embeddable UI components, to an application. Reviewers approve or deny the requests in a connected User Management element.

Access Request element showing Access Restricted, a message, and a Request Access button

How access requests work

  1. A user without the access they need opens the Access Request element in your application and clicks Request Access.
  2. Permit sends the request to the User Management element that the Access Request element is connected to.
  3. A user whose role is at Level 1 (Workspace Owner) in that User Management element approves or denies the request. See Permission levels.
  4. If the reviewer approves, Permit assigns the requested role to the user.

For example, in a blog application, a user with the viewer role can't write articles, and a user with the editor role can. A viewer who wants to write requests access through the Access Request element. An admin reviews the request and approves it, and the user gets the editor role.

Access request flow: a user with the viewer role requests access in the Access Request element, an admin reviews the request, approval grants the editor role, and denial keeps the viewer role

Prerequisites

  • Roles for your policy, created on the Roles page of the Permit dashboard.

  • A User Management element with your reviewer roles at Level 1. Reviewers see pending access requests in this element.

    User Management element listing users and a pending user

    Create form for a User Management element

  • JWKS or a backend login route set up for element login. See Embed Permit Elements.

Create and connect the element

1. Create the Access Request element

In the Elements screen, under Access Request, click Create Element.

Elements screen with the Create Element button under Access Request

2. Select the User Management element

Select the User Management element that receives the requests from this Access Request element.

Access Request element form with the User Management element dropdown

3. Name the element

Enter a name for the element, and click Create.

4. Open the User Management element

Go back to the Elements screen, and open the User Management element you selected in step 2.

5. Connect the Access Request element

Under Approval Component in user management, select the Access Request element you created, and save the User Management element.

The Access Request element is connected to the User Management element.

Customize the element

In the Access Request element form, you can change:

  • The background color and the button color
  • The title, the message, and the button text

Access Request element form with color, title, message, and button text settings

In the User Management element form, you can change the approval button color, and choose which request details the element displays.

Approval settings in the User Management element form

The User Management element lists the users whose requests wait for approval.

User Management element listing users awaiting approval

Add the iframe to your application

  1. Open the Access Request element, and click Generate Code at the top of the screen.

    Access Request element page with the Generate Code button

  2. Copy the iframe snippet, and paste it into the page where users request access.

  3. Replace the placeholders in src with your values.

Placeholders in the iframe src

PlaceholderValue
<ELEMENT_NAME>The name of the element you created.
<SOME_UNIQUE_ID>The ID of your environment.
<TENANT_KEY>The key of the tenant the element applies to.
Set the tenant

Set <TENANT_KEY> to the tenant the element applies to. The element doesn't work correctly without the right tenant.

<iframe
title="Permit Element Name"
src="https://embed.permit.io/<ELEMENT_NAME>?envId=<SOME_UNIQUE_ID>&darkMode=false&tenantKey=<TENANT_KEY>"
width="100%"
height="100%"
style="border: none;"
/>

Log users in to the element

Before the iframe loads, log the user in to Permit Elements with permit.elements.login(). For the steps, see Embed Permit Elements. For all login methods, see Log users in to Permit Elements.

Verify the access request flow

  1. Sign in to your application as a user without the role to request, and click Request Access in the Access Request element.
  2. Sign in as a user whose role is at Level 1 in the connected User Management element. The request appears in the list of users awaiting approval.
  3. Approve the request.
  4. In the Permit dashboard, open Directory. The requesting user has the approved role.

Next steps