OAuth2 Applications

Register OAuth2 application

Registers a new OAuth2 application for a specific provider

post/v1/oauth2

Request

  • Base URL: https://your-emailengine-host
  • URL: https://your-emailengine-host/v1/oauth2
  • Auth: HTTP bearer

Headers

x-ee-timeoutinteger

Request timeout in milliseconds. Raises the command timeout above the EENGINE_TIMEOUT default for a long-running request; a value below the default has no effect

Example:30000

Request body

namestring required

Display name for the OAuth2 application

descriptionstring

Detailed description of the application

titlestring

Short title shown on the OAuth2 button

provider'gmail' | 'gmailService' | 'outlook' | 'outlookService' | 'mailRu' required

OAuth2 provider type

enabledboolean

Whether this OAuth2 app is active

clientIdstring

OAuth2 client ID from the provider

clientSecretstring

OAuth2 client secret from the provider

baseScopes'imap' | 'api' | 'pubsub'

Connection type (IMAP, API, or Pub/Sub)

extraScopesstring[]
skipScopesstring[]
serviceClientstring

Service account unique ID (for 2-legged OAuth2)

googleWorkspaceAccountsboolean

Restrict OAuth2 login to Google Workspace accounts only

serviceClientEmailstring

Service account email address

serviceKeystring

Service account private key in PEM format

authMethod'serviceKey' | 'externalAccount' | 'metadataServer'

How the Gmail service account authenticates

externalAccountstring

Google external_account credential JSON for Workload Identity Federation

authoritystring

Microsoft tenant configuration (common, organizations, consumers, or tenant ID)

cloudstring

Microsoft Azure cloud environment

redirectUrlstring

OAuth2 redirect URI configured in the provider

Example request

{
  "name": "My Gmail App",
  "description": "My cool app",
  "title": "App title",
  "provider": "gmail",
  "enabled": true,
  "clientId": "52422112755-3uov8bjwlrullq122rdm6l8ui25ho7qf.apps.googleusercontent.com",
  "clientSecret": "boT7Q~dUljnfFdVuqpC11g8nGMjO8kpRAv-ZB",
  "baseScopes": "imap",
  "pubSubApp": "AAAAAQAACnA",
  "extraScopes": [
    "User.Read"
  ],
  "skipScopes": [
    "SMTP.Send"
  ],
  "serviceClient": "7103296518315821565203",
  "googleProjectId": "project-name-425411",
  "googleTopicName": "ee-pub-12345",
  "googleSubscriptionName": "ee-sub-12345",
  "serviceClientEmail": "name@project-123.iam.gserviceaccount.com",
  "serviceKey": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgk...",
  "authMethod": "externalAccount",
  "externalAccount": "{\"type\":\"external_account\",\"audience\":\"//iam.googleapis.com/projects/.../providers/...\",...}",
  "authority": "common",
  "cloud": "global",
  "redirectUrl": "https://myservice.com/oauth"
}

Response

Returns the registered OAuth2 application.

idstring required

OAuth2 application ID

createdboolean

Was the app created

Example response

{
  "id": "AAABhaBPHscAAAAH"
}

Changes

No recorded changes to this operation across all 1 revision of this API.