Skip to main content
POST
/
connected-accounts
/
connect
TypeScript
import { MyAccountClient } from "github.com/auth0/myaccount-js";

async function main() {
    const client = new MyAccountClient({
        token: "<token>",
    });
    await client.connectedAccounts.create({
        connection: "connection",
        redirectUri: "redirect_uri",
    });
}
main();
{
  "connect_uri": "<string>",
  "auth_session": "<string>",
  "connect_params": {
    "ticket": "<string>"
  },
  "expires_in": 2
}

Authorizations

Authorization
string
header
required

Bearer and DPoP tokens are supported depending on the API configuration

Body

application/json

Request body for creating an account connection request.

connection
string
required

The name of the connection to link the account with (e.g., 'google-oauth2', 'facebook').

Required string length: 1 - 128
redirect_uri
string<uri>
required

The URI to redirect to after the connection process completes.

Maximum string length: 2048
state
string

An opaque value used to maintain state between the request and callback.

Required string length: 1 - 4096
code_challenge
string

The PKCE code challenge derived from the code verifier.

Required string length: 43 - 128
code_challenge_method
string

The method used to derive the code challenge. Required when code_challenge is provided.

Allowed value: "S256"
scopes
string[]

Defines the permissions that the client requests from the Identity Provider. Must include the standard scopes used to identify the user (e.g. 'openid', 'email', 'profile'), the scope required to obtain refresh tokens if needed (e.g. 'offline_access'), and any custom scopes the client needs to access protected resources.

Required array length: 1 - 100 elements
Required string length: 1 - 255
Example:
[
"openid",
"offline_access",
"read:tasks",
"write:tasks"
]
authorization_params
Authorization Parameters · object

Authorization parameters to be sent to the underlying Identity Provider (IdP) during the authorization request. These parameters influence how the IdP processes the authorization flow and what permissions are requested.

Response

Account connection request created successfully

connect_uri
string<uri>
required

The base URI to initiate the account connection flow.

auth_session
string
required

The authentication session identifier.

Maximum string length: 64
connect_params
object
required

Parameters to be used with the connect URI.

expires_in
integer
required

The number of seconds until the ticket expires.

Required range: x >= 1