1. Packages
  2. Auth0 Provider
  3. API Docs
  4. ClientGrant
Auth0 v3.16.0 published on Wednesday, Mar 12, 2025 by Pulumi

auth0.ClientGrant

Explore with Pulumi AI

Auth0 uses various grant types, or methods by which you grant limited access to your resources to another entity without exposing credentials. The OAuth 2.0 protocol supports several types of grants, which allow different types of access. This resource allows you to create and manage client grants used with configured Auth0 clients.

Example Usage

Coming soon!
Coming soon!
Coming soon!
Coming soon!
Coming soon!
resources:
  # The following example grants a client the "create:foo" and "create:bar" permissions (scopes).
  myClient:
    type: auth0:Client
    name: my_client
    properties:
      name: Example Application - Client Grant (Managed by Terraform)
  myResourceServer:
    type: auth0:ResourceServer
    name: my_resource_server
    properties:
      name: Example Resource Server - Client Grant (Managed by Terraform)
      identifier: https://api.example.com/client-grant
      scopes:
        - value: create:foo
          description: Create foos
        - value: create:bar
          description: Create bars
  myClientGrant:
    type: auth0:ClientGrant
    name: my_client_grant
    properties:
      clientId: ${myClient.id}
      audience: ${myResourceServer.identifier}
      scopes:
        - create:foo
        - create:bar
Copy

Create ClientGrant Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ClientGrant(name: string, args: ClientGrantArgs, opts?: CustomResourceOptions);
@overload
def ClientGrant(resource_name: str,
                args: ClientGrantArgs,
                opts: Optional[ResourceOptions] = None)

@overload
def ClientGrant(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                audience: Optional[str] = None,
                client_id: Optional[str] = None,
                scopes: Optional[Sequence[str]] = None,
                allow_any_organization: Optional[bool] = None,
                organization_usage: Optional[str] = None)
func NewClientGrant(ctx *Context, name string, args ClientGrantArgs, opts ...ResourceOption) (*ClientGrant, error)
public ClientGrant(string name, ClientGrantArgs args, CustomResourceOptions? opts = null)
public ClientGrant(String name, ClientGrantArgs args)
public ClientGrant(String name, ClientGrantArgs args, CustomResourceOptions options)
type: auth0:ClientGrant
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ClientGrantArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ClientGrantArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ClientGrantArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ClientGrantArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ClientGrantArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var clientGrantResource = new Auth0.ClientGrant("clientGrantResource", new()
{
    Audience = "string",
    ClientId = "string",
    Scopes = new[]
    {
        "string",
    },
    AllowAnyOrganization = false,
    OrganizationUsage = "string",
});
Copy
example, err := auth0.NewClientGrant(ctx, "clientGrantResource", &auth0.ClientGrantArgs{
	Audience: pulumi.String("string"),
	ClientId: pulumi.String("string"),
	Scopes: pulumi.StringArray{
		pulumi.String("string"),
	},
	AllowAnyOrganization: pulumi.Bool(false),
	OrganizationUsage:    pulumi.String("string"),
})
Copy
var clientGrantResource = new ClientGrant("clientGrantResource", ClientGrantArgs.builder()
    .audience("string")
    .clientId("string")
    .scopes("string")
    .allowAnyOrganization(false)
    .organizationUsage("string")
    .build());
Copy
client_grant_resource = auth0.ClientGrant("clientGrantResource",
    audience="string",
    client_id="string",
    scopes=["string"],
    allow_any_organization=False,
    organization_usage="string")
Copy
const clientGrantResource = new auth0.ClientGrant("clientGrantResource", {
    audience: "string",
    clientId: "string",
    scopes: ["string"],
    allowAnyOrganization: false,
    organizationUsage: "string",
});
Copy
type: auth0:ClientGrant
properties:
    allowAnyOrganization: false
    audience: string
    clientId: string
    organizationUsage: string
    scopes:
        - string
Copy

ClientGrant Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ClientGrant resource accepts the following input properties:

Audience
This property is required.
Changes to this property will trigger replacement.
string
Audience or API Identifier for this grant.
ClientId
This property is required.
Changes to this property will trigger replacement.
string
ID of the client for this grant.
Scopes This property is required. List<string>
Permissions (scopes) included in this grant.
AllowAnyOrganization bool
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
OrganizationUsage string
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)
Audience
This property is required.
Changes to this property will trigger replacement.
string
Audience or API Identifier for this grant.
ClientId
This property is required.
Changes to this property will trigger replacement.
string
ID of the client for this grant.
Scopes This property is required. []string
Permissions (scopes) included in this grant.
AllowAnyOrganization bool
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
OrganizationUsage string
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)
audience
This property is required.
Changes to this property will trigger replacement.
String
Audience or API Identifier for this grant.
clientId
This property is required.
Changes to this property will trigger replacement.
String
ID of the client for this grant.
scopes This property is required. List<String>
Permissions (scopes) included in this grant.
allowAnyOrganization Boolean
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
organizationUsage String
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)
audience
This property is required.
Changes to this property will trigger replacement.
string
Audience or API Identifier for this grant.
clientId
This property is required.
Changes to this property will trigger replacement.
string
ID of the client for this grant.
scopes This property is required. string[]
Permissions (scopes) included in this grant.
allowAnyOrganization boolean
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
organizationUsage string
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)
audience
This property is required.
Changes to this property will trigger replacement.
str
Audience or API Identifier for this grant.
client_id
This property is required.
Changes to this property will trigger replacement.
str
ID of the client for this grant.
scopes This property is required. Sequence[str]
Permissions (scopes) included in this grant.
allow_any_organization bool
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
organization_usage str
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)
audience
This property is required.
Changes to this property will trigger replacement.
String
Audience or API Identifier for this grant.
clientId
This property is required.
Changes to this property will trigger replacement.
String
ID of the client for this grant.
scopes This property is required. List<String>
Permissions (scopes) included in this grant.
allowAnyOrganization Boolean
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
organizationUsage String
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)

Outputs

All input properties are implicitly available as output properties. Additionally, the ClientGrant resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ClientGrant Resource

Get an existing ClientGrant resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ClientGrantState, opts?: CustomResourceOptions): ClientGrant
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        allow_any_organization: Optional[bool] = None,
        audience: Optional[str] = None,
        client_id: Optional[str] = None,
        organization_usage: Optional[str] = None,
        scopes: Optional[Sequence[str]] = None) -> ClientGrant
func GetClientGrant(ctx *Context, name string, id IDInput, state *ClientGrantState, opts ...ResourceOption) (*ClientGrant, error)
public static ClientGrant Get(string name, Input<string> id, ClientGrantState? state, CustomResourceOptions? opts = null)
public static ClientGrant get(String name, Output<String> id, ClientGrantState state, CustomResourceOptions options)
resources:  _:    type: auth0:ClientGrant    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AllowAnyOrganization bool
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
Audience Changes to this property will trigger replacement. string
Audience or API Identifier for this grant.
ClientId Changes to this property will trigger replacement. string
ID of the client for this grant.
OrganizationUsage string
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)
Scopes List<string>
Permissions (scopes) included in this grant.
AllowAnyOrganization bool
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
Audience Changes to this property will trigger replacement. string
Audience or API Identifier for this grant.
ClientId Changes to this property will trigger replacement. string
ID of the client for this grant.
OrganizationUsage string
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)
Scopes []string
Permissions (scopes) included in this grant.
allowAnyOrganization Boolean
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
audience Changes to this property will trigger replacement. String
Audience or API Identifier for this grant.
clientId Changes to this property will trigger replacement. String
ID of the client for this grant.
organizationUsage String
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)
scopes List<String>
Permissions (scopes) included in this grant.
allowAnyOrganization boolean
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
audience Changes to this property will trigger replacement. string
Audience or API Identifier for this grant.
clientId Changes to this property will trigger replacement. string
ID of the client for this grant.
organizationUsage string
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)
scopes string[]
Permissions (scopes) included in this grant.
allow_any_organization bool
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
audience Changes to this property will trigger replacement. str
Audience or API Identifier for this grant.
client_id Changes to this property will trigger replacement. str
ID of the client for this grant.
organization_usage str
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)
scopes Sequence[str]
Permissions (scopes) included in this grant.
allowAnyOrganization Boolean
If enabled, any organization can be used with this grant. If disabled (default), the grant must be explicitly assigned to the desired organizations.
audience Changes to this property will trigger replacement. String
Audience or API Identifier for this grant.
clientId Changes to this property will trigger replacement. String
ID of the client for this grant.
organizationUsage String
Defines whether organizations can be used with client credentials exchanges for this grant. (defaults to deny when not defined)
scopes List<String>
Permissions (scopes) included in this grant.

Import

This resource can be imported by specifying the client grant ID.

You can find this within the Management Dashboard in Application -> APIs -> Expand the required API.

Example:

$ pulumi import auth0:index/clientGrant:ClientGrant my_client_grant "cgr_XXXXXXXXXXXXXXXX"
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Auth0 pulumi/pulumi-auth0
License
Apache-2.0
Notes
This Pulumi package is based on the auth0 Terraform Provider.