| title | Create Oauth providers |
|---|---|
| description | Create Oauth providers for a specified user. |
import { Authorizations } from "/snippets/api/authorizations.mdx"; import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; import { EndpointPath } from "/snippets/api/endpoint.mdx";
Enum options: ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS_V2
Timestamp (in milliseconds) of the request, used to verify liveness of user requests.
Unique identifier for a given Organization.
The parameters object containing the specific intent data for this activity.
The ID of the User to add an Oauth provider to<ParamField body="oauthProviders" type="array" required={true} path="parameters.oauthProviders">
<p>A list of Oauth providers.</p>
<Expandable title="item details">
<NestedParam parentKey="parameters.oauthProviders" childKey="providerName" type="string" required={true} default="">
Human-readable name to identify a Provider.
</NestedParam>
<NestedParam parentKey="parameters.oauthProviders" childKey="oidcToken" type="string" required={false} default="">
Base64 encoded OIDC token
</NestedParam>
<ParamField body="oidcClaims" type="object" required={false} path="parameters.oauthProviders.oidcClaims">
<p>oidcClaims field</p>
<Expandable title="details">
<NestedParam parentKey="parameters.oauthProviders.oidcClaims" childKey="iss" type="string" required={true} default="">
The issuer identifier from the OIDC token (iss claim)
</NestedParam>
<NestedParam parentKey="parameters.oauthProviders.oidcClaims" childKey="sub" type="string" required={true} default="">
The subject identifier from the OIDC token (sub claim)
</NestedParam>
<NestedParam parentKey="parameters.oauthProviders.oidcClaims" childKey="aud" type="string" required={true} default="">
The audience from the OIDC token (aud claim)
</NestedParam>
</Expandable>
</ParamField>
</Expandable>
</ParamField>
Enable to have your activity generate and return App Proofs, enabling verifiability.
A successful response returns the following fields: The activity object containing type, intent, and result Unique identifier for a given Activity object. Unique identifier for a given Organization. The activity status The activity type The intent of the activity The createOauthProvidersIntentV2 object The ID of the User to add an Oauth provider to A list of Oauth providers. Human-readable name to identify a Provider. Base64 encoded OIDC token oidcClaims field The issuer identifier from the OIDC token (iss claim) The subject identifier from the OIDC token (sub claim) The audience from the OIDC token (aud claim) </Expandable>
</NestedParam>
</Expandable>
</NestedParam>
</Expandable>
</NestedParam>
</Expandable>
</NestedParam>
</Expandable>
</NestedParam>
</Expandable>
</NestedParam>
</Expandable>
</NestedParam>
For a detailed breakdown of potential error codes, please refer to our Error Documentation.
curl --request POST \
--url https://api.turnkey.com/public/v1/submit/create_oauth_providers \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header "X-Stamp: <string> (see Authorizations)" \
--data '{
"type": "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS_V2",
"timestampMs": "<string> (e.g. 1746736509954)",
"organizationId": "<string> (Your Organization ID)",
"parameters": {
"userId": "<string>",
"oauthProviders": [
{
"providerName": "<string>",
"oidcToken": "<string>",
"oidcClaims": {
"iss": "<string>",
"sub": "<string>",
"aud": "<string>"
}
}
]
}
}'import { Turnkey } from "@turnkey/sdk-server";
const turnkeyClient = new Turnkey({
apiBaseUrl: "https://api.turnkey.com",
apiPublicKey: process.env.API_PUBLIC_KEY!,
apiPrivateKey: process.env.API_PRIVATE_KEY!,
defaultOrganizationId: process.env.ORGANIZATION_ID!,
});
const response = await turnkeyClient.apiClient().createOauthProviders({
userId: "<string> (The ID of the User to add an Oauth provider to)",
oauthProviders: [{ // A list of Oauth providers.,
providerName: "<string> (Human-readable name to identify a Provider.)",
oidcToken: "<string> (Base64 encoded OIDC token)",
oidcClaims: { // oidcClaims field,
iss: "<string> (The issuer identifier from the OIDC token (iss claim))",
sub: "<string> (The subject identifier from the OIDC token (sub claim))",
aud: "<string> (The audience from the OIDC token (aud claim))",
},
}]
});{
"activity": {
"id": "<activity-id>",
"status": "ACTIVITY_STATUS_COMPLETED",
"type": "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS_V2",
"organizationId": "<organization-id>",
"timestampMs": "<timestamp> (e.g. 1746736509954)",
"result": {
"activity": {
"id": "<string>",
"organizationId": "<string>",
"status": "<string>",
"type": "<string>",
"intent": {
"createOauthProvidersIntentV2": {
"userId": "<string>",
"oauthProviders": [
{
"providerName": "<string>",
"oidcToken": "<string>",
"oidcClaims": {
"iss": "<string>",
"sub": "<string>",
"aud": "<string>"
}
}
]
}
},
"result": {
"createOauthProvidersResultV2": {
"providerIds": [
"<string>"
]
}
},
"votes": "<array>",
"fingerprint": "<string>",
"canApprove": "<boolean>",
"canReject": "<boolean>",
"createdAt": "<string>",
"updatedAt": "<string>"
}
}
}
}