Module: WorkOS::Portal

Extended by:
Client
Defined in:
lib/workos/portal.rb

Overview

The Portal module provides resource methods for working with the Admin Portal product

Constant Summary collapse

WorkOS::Types::Intent::ALL

Class Method Summary collapse

Methods included from Client

client, delete_request, execute_request, get_request, handle_error_response, post_request, put_request, user_agent

Class Method Details

Generate a link to grant access to an organization’s Admin Portal

Parameters:

  • intent (String)

    The access scope for the generated Admin Portal link. Valid values are: [“audit_logs”, “dsync”, “log_streams”, “sso”,]

  • organization (String)

    The ID of the organization the Admin Portal link will be generated for.

  • The (String)

    URL that the end user will be redirected to upon exiting the generated Admin Portal. If none is provided, the default redirect link set in your WorkOS Dashboard will be used.

  • The (String)

    URL to which WorkOS will redirect users to upon successfully setting up Single Sign On or Directory Sync.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/workos/portal.rb', line 25

def generate_link(intent:, organization:, return_url: nil, success_url: nil)
  validate_intent(intent)

  request = post_request(
    auth: true,
    body: {
      intent: intent,
      organization: organization,
      return_url: return_url,
      success_url: success_url,
    },
    path: '/portal/generate_link',
  )

  response = execute_request(request: request)

  JSON.parse(response.body)['link']
end