1. Packages
  2. Okta Provider
  3. API Docs
  4. app
  5. getToken
Okta v6.2.0 published on Thursday, Dec 11, 2025 by Pulumi
okta logo
Okta v6.2.0 published on Thursday, Dec 11, 2025 by Pulumi

    Retrieves a refresh token for the specified app.

    Example Usage

    Basic Token Information

    import * as pulumi from "@pulumi/pulumi";
    import * as okta from "@pulumi/okta";
    
    const example = okta.app.getToken({
        clientId: "0oardd5r32PWsF4421d7",
        id: "oar1godmqw4QUiX4C1d7",
    });
    export const tokenStatus = example.then(example => example.status);
    export const tokenUser = example.then(example => example.userId);
    
    import pulumi
    import pulumi_okta as okta
    
    example = okta.app.get_token(client_id="0oardd5r32PWsF4421d7",
        id="oar1godmqw4QUiX4C1d7")
    pulumi.export("tokenStatus", example.status)
    pulumi.export("tokenUser", example.user_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-okta/sdk/v6/go/okta/app"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := app.LookupToken(ctx, &app.LookupTokenArgs{
    			ClientId: "0oardd5r32PWsF4421d7",
    			Id:       "oar1godmqw4QUiX4C1d7",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("tokenStatus", example.Status)
    		ctx.Export("tokenUser", example.UserId)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Okta = Pulumi.Okta;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Okta.App.GetToken.Invoke(new()
        {
            ClientId = "0oardd5r32PWsF4421d7",
            Id = "oar1godmqw4QUiX4C1d7",
        });
    
        return new Dictionary<string, object?>
        {
            ["tokenStatus"] = example.Apply(getTokenResult => getTokenResult.Status),
            ["tokenUser"] = example.Apply(getTokenResult => getTokenResult.UserId),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.okta.app.AppFunctions;
    import com.pulumi.okta.app.inputs.GetTokenArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var example = AppFunctions.getToken(GetTokenArgs.builder()
                .clientId("0oardd5r32PWsF4421d7")
                .id("oar1godmqw4QUiX4C1d7")
                .build());
    
            ctx.export("tokenStatus", example.status());
            ctx.export("tokenUser", example.userId());
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: okta:app:getToken
          arguments:
            clientId: 0oardd5r32PWsF4421d7
            id: oar1godmqw4QUiX4C1d7
    outputs:
      tokenStatus: ${example.status}
      tokenUser: ${example.userId}
    

    Using getToken

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getToken(args: GetTokenArgs, opts?: InvokeOptions): Promise<GetTokenResult>
    function getTokenOutput(args: GetTokenOutputArgs, opts?: InvokeOptions): Output<GetTokenResult>
    def get_token(client_id: Optional[str] = None,
                  id: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetTokenResult
    def get_token_output(client_id: Optional[pulumi.Input[str]] = None,
                  id: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetTokenResult]
    func LookupToken(ctx *Context, args *LookupTokenArgs, opts ...InvokeOption) (*LookupTokenResult, error)
    func LookupTokenOutput(ctx *Context, args *LookupTokenOutputArgs, opts ...InvokeOption) LookupTokenResultOutput

    > Note: This function is named LookupToken in the Go SDK.

    public static class GetToken 
    {
        public static Task<GetTokenResult> InvokeAsync(GetTokenArgs args, InvokeOptions? opts = null)
        public static Output<GetTokenResult> Invoke(GetTokenInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetTokenResult> getToken(GetTokenArgs args, InvokeOptions options)
    public static Output<GetTokenResult> getToken(GetTokenArgs args, InvokeOptions options)
    
    fn::invoke:
      function: okta:app/getToken:getToken
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ClientId string
    The unique Okta ID of the application associated with this token. This is typically the client_id of an application.
    Id string
    The unique Okta ID of the refresh token to retrieve.
    ClientId string
    The unique Okta ID of the application associated with this token. This is typically the client_id of an application.
    Id string
    The unique Okta ID of the refresh token to retrieve.
    clientId String
    The unique Okta ID of the application associated with this token. This is typically the client_id of an application.
    id String
    The unique Okta ID of the refresh token to retrieve.
    clientId string
    The unique Okta ID of the application associated with this token. This is typically the client_id of an application.
    id string
    The unique Okta ID of the refresh token to retrieve.
    client_id str
    The unique Okta ID of the application associated with this token. This is typically the client_id of an application.
    id str
    The unique Okta ID of the refresh token to retrieve.
    clientId String
    The unique Okta ID of the application associated with this token. This is typically the client_id of an application.
    id String
    The unique Okta ID of the refresh token to retrieve.

    getToken Result

    The following output properties are available:

    ClientId string
    Created string
    Timestamp when the token was created, in RFC3339 format.
    ExpiresAt string
    Timestamp when the token expires, in RFC3339 format.
    Id string
    Issuer string
    The complete URL of the authorization server that issued the token.
    Scopes List<string>
    List of scope names attached to the token.
    Status string
    The current status of the token (e.g., ACTIVE, REVOKED).
    UserId string
    The unique ID of the user associated with this token.
    ClientId string
    Created string
    Timestamp when the token was created, in RFC3339 format.
    ExpiresAt string
    Timestamp when the token expires, in RFC3339 format.
    Id string
    Issuer string
    The complete URL of the authorization server that issued the token.
    Scopes []string
    List of scope names attached to the token.
    Status string
    The current status of the token (e.g., ACTIVE, REVOKED).
    UserId string
    The unique ID of the user associated with this token.
    clientId String
    created String
    Timestamp when the token was created, in RFC3339 format.
    expiresAt String
    Timestamp when the token expires, in RFC3339 format.
    id String
    issuer String
    The complete URL of the authorization server that issued the token.
    scopes List<String>
    List of scope names attached to the token.
    status String
    The current status of the token (e.g., ACTIVE, REVOKED).
    userId String
    The unique ID of the user associated with this token.
    clientId string
    created string
    Timestamp when the token was created, in RFC3339 format.
    expiresAt string
    Timestamp when the token expires, in RFC3339 format.
    id string
    issuer string
    The complete URL of the authorization server that issued the token.
    scopes string[]
    List of scope names attached to the token.
    status string
    The current status of the token (e.g., ACTIVE, REVOKED).
    userId string
    The unique ID of the user associated with this token.
    client_id str
    created str
    Timestamp when the token was created, in RFC3339 format.
    expires_at str
    Timestamp when the token expires, in RFC3339 format.
    id str
    issuer str
    The complete URL of the authorization server that issued the token.
    scopes Sequence[str]
    List of scope names attached to the token.
    status str
    The current status of the token (e.g., ACTIVE, REVOKED).
    user_id str
    The unique ID of the user associated with this token.
    clientId String
    created String
    Timestamp when the token was created, in RFC3339 format.
    expiresAt String
    Timestamp when the token expires, in RFC3339 format.
    id String
    issuer String
    The complete URL of the authorization server that issued the token.
    scopes List<String>
    List of scope names attached to the token.
    status String
    The current status of the token (e.g., ACTIVE, REVOKED).
    userId String
    The unique ID of the user associated with this token.

    Package Details

    Repository
    Okta pulumi/pulumi-okta
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the okta Terraform Provider.
    okta logo
    Okta v6.2.0 published on Thursday, Dec 11, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate