scope
claim of an . APIs can then use this information to apply the appropriate level of access control, which allows your API to enforce policy rules without having to do an extra lookup to get information about the user.organization
object contained within the Rules context
object. The organization
object also provides access to any metadata provisioned against an Organization definition in Auth0. To learn more, see Custom Development for Organizations.org_id
claim is automatically added to any identity token (for an example, see Work with Tokens and Organizations) issued for users with organization membership. This parameter is validated by Auth0 SDKs. You can also add supplemental information associated with an Auth0 Organization by adding a custom claim to the identity token:
org_name
claim is automatically included in ID tokens. To learn more, review Use Organization Names in Authentication API.
user
object in a Rule, which will either map to standard claims in an identity token or can be mapped using custom claims. To learn more about customizing SAML mappings, see Connect Your App to SAML Identity Providers: Set up mappings.
org_id
claim is automatically added to any access token (for an example, see Work with Tokens and Organizations) issued for users with organization membership. You can also add supplemental information associated with an Auth0 Organization by adding a custom claim to the access token:
org_name
claim is automatically included in access tokens. To learn more, review Use Organization Names in Authentication API.
Alternatively, you could create a unique API for each organization, which would result in a unique API definition in Auth0. While this mechanism can mitigate the need for employing custom Rule extensibility, the complexity it introduces can be challenging. A simple comparison is as follows:
Approach | Pros | Cons |
---|---|---|
Unique API Audience | * Out-of-the-box support for machine-to-machine access for a single organization. * Audience is a standard claim in an access token. * Refresh token processing requires no additional organization logic. | * Must automate the creation of an API for every organization. * Independent roles may need to be created if using RBAC. Must automate the provisioning of Roles to Membership.* API implementation has to process for multiple audiences. |
Custom Claim | Simplifies Auth0 Tenant configuration. | Custom code needed in a rule to add the organization to the access token. |
scope
claim in access tokens being modified automatically and a permission
claim being added by default (for an example, see Work with Tokens and Organizations). You can also add role information to identity tokens as custom claims by accessing the authorization
object available in the Rules context
object. To learn more, see Rules with Authorization Sample Use Cases: Add User Roles to Tokens.