Member Junction
    Preparing search index...

    Action that handles OAuth 2.0 authentication flows

    // Authorization Code flow - Step 1: Get auth URL
    const authResult = await runAction({
    ActionName: 'OAuth Flow',
    Params: [{
    Name: 'Operation',
    Value: 'GetAuthorizationURL'
    }, {
    Name: 'Provider',
    Value: 'github'
    }, {
    Name: 'ClientID',
    Value: 'your-client-id'
    }, {
    Name: 'RedirectURI',
    Value: 'http://localhost:3000/callback'
    }, {
    Name: 'Scopes',
    Value: ['user', 'repo']
    }]
    });

    // Step 2: Exchange code for token
    const tokenResult = await runAction({
    ActionName: 'OAuth Flow',
    Params: [{
    Name: 'Operation',
    Value: 'ExchangeCodeForToken'
    }, {
    Name: 'Provider',
    Value: 'github'
    }, {
    Name: 'ClientID',
    Value: 'your-client-id'
    }, {
    Name: 'ClientSecret',
    Value: 'your-client-secret'
    }, {
    Name: 'Code',
    Value: 'auth-code-from-callback'
    }, {
    Name: 'RedirectURI',
    Value: 'http://localhost:3000/callback'
    }]
    });

    // Client Credentials flow
    const tokenResult = await runAction({
    ActionName: 'OAuth Flow',
    Params: [{
    Name: 'Operation',
    Value: 'ClientCredentials'
    }, {
    Name: 'Provider',
    Value: 'custom'
    }, {
    Name: 'TokenEndpoint',
    Value: 'https://api.example.com/oauth/token'
    }, {
    Name: 'ClientID',
    Value: 'your-client-id'
    }, {
    Name: 'ClientSecret',
    Value: 'your-client-secret'
    }]
    });

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    AuthorizesCaller: boolean

    True when the action authorizes its caller itself, so a public entry point such as the RunAction mutation may run it for an authenticated user without an MJ: Action Authorizations link. Set it only on an action that either checks an authorization the caller must hold, or reads and writes only with the caller's own permissions. Leave it false for an action that acts with more authority than its caller, or that reaches data or sends messages the caller chooses but could not otherwise reach.

    The engine reads the marker only from the class that runs, never from its parent classes. A subclass that overrides a marked action must declare the marker again.

    Methods

    • Handles OAuth 2.0 authentication flows

      Parameters

      • params: RunActionParams

        The action parameters containing:

        • Operation: "GetAuthorizationURL" | "ExchangeCodeForToken" | "RefreshToken" | "ClientCredentials" (required)
        • Provider: Provider name or "custom" (required)
        • ClientID: OAuth client ID (required)
        • ClientSecret: OAuth client secret (required for token operations)
        • RedirectURI: Callback URL (required for auth code flow)
        • Scopes: Array of scopes (optional)
        • State: State parameter for CSRF protection (optional, auto-generated if not provided)
        • Code: Authorization code (for ExchangeCodeForToken)
        • RefreshToken: Refresh token (for RefreshToken operation)
        • AuthorizationEndpoint: Custom auth endpoint (for custom provider)
        • TokenEndpoint: Custom token endpoint (for custom provider)
        • ScopeSeparator: Custom scope separator (default: space)

      Returns Promise<ActionResultSimple>

      OAuth flow result (authorization URL or tokens)