Apply unique branding for an organization
Design
Organizations allow you to group your users into buckets. An organization in Kinde could represent a club, a company, a practice, a department - however you model your business. We’ll refer to them collectively as organizations in this topic.
There are three ways of creating an organization.
By default Kinde allows organizations to self-sign up to your project. You can turn this off in Kinde if you prefer to handle registration another way.
To initiate the organization self-sign up flow pass the is_create_org
parameter in the auth url when redirecting to Kinde. This will prompt the user to register an account and upon successful registration create an organization in the background on Kinde.
Our SDKs contain helpers to achieve this. The below example is from the Kinde React SDK, which ships with a createOrg
method.
See the relevant SDK doc for your stack, for examples on how to do this.
If you want to pass an organization name to Kinde, you can pass it in the auth url with the org_name
parameter. A common pattern is to provide an input field in your project for the user to type their preferred name.
Here’s another example using React.
See the relevant SDK doc for your stack, for examples on how to do this.
There are a few ways of doing this.
As noted earlier, Kinde has the notion of a default organization where new users are placed if we don’t know which organization they belong to.
This can be switched off, or you can pass an org_code
parameter in the auth URL to specify which organization you would like users to sign up to.
Caution: the org_code
in the http request is vulnerable to manipulation, so only allow registrations to organizations that you would allow anyone to sign up to. If this is not the case, we suggest you leave this switched off and add the user to the right organization later via the Kinde management API.
Our SDKs provide specific helper methods for passing the org_code
parameter. For example, in React, this can be achieved as follows:
See the relevant SDK doc for your stack, for examples on how to do this.
The flows are slightly different depending on whether you supply an organization code to us in the auth url as org_code
parameter.
No org code provided
If Kinde is not provided with an org_code
, there are three possible outcomes:
org_code
claim will be omitted from the access token.Code wise there is nothing different to do from a standard sign in. Again, a React example:
See the relevant SDK doc for your stack, for examples on how to do this.
Org code provided
If Kinde receives the org_code
parameter in the auth url it means two things:
Our SDKs describe how to provide the org code
in the auth url. Here’s an example from React.
See the relevant SDK doc for your stack, for examples on how to do this.
We refer to the organization’s ID as an org_code
which is unique for each organization. Once a user has authenticated and is returned to your project we expose the org_code
in their access token.
Each SDK has a way of accessing this. For example in React:
See the relevant SDK doc for your stack, for examples on how to do this.
If a user belongs to multiple organizations, you might find it useful to get a list of them. You could do this in a couple of ways:
id_token
(see below).We provide an array of organization codes in the org_codes
claim of the id_token
. You can either use a JWT parser to extract these, or use our SDKs provide helper methods.
In React you can use the following helper:
A user can have different roles and permissions per organization. This means they can have an admin
role in Organization ABC but a member
role in Organization XYZ.
You can manage these roles and permissions:
access_token
(see below). Note that only permissions specific to the organization the user is signed into will be returned.We provide an array of permissions in the permissions
claim of the access_token
. You can either use a JWT parser to extract these, or using our SDK helper methods.
In React you can use the following helper:
Our SDKs also ship with helpers for handling permission checks. For example in React you could use:
Then you could gate the feature as follows:
See the relevant SDK doc for your stack, for examples on how to do this.
You can use feature flags to provide different features to different organizations. This is especially helpful if you want to beta test a new feature for your project and only release it to selected organizations.
You can manage these feature flags:
access_token
(see below).We provide an array of flags in the feature_flags
claim of the access_token
. You can use a JWT parser extract these, or use an appropriate SDK for handler examples.
Here’s an example from the React SDK.