Create an OAuth2 credential

Initiates the creation of an OAuth2 credential that can be re-used in webhooks. The result is a RedirectUrl which must be authenticated, and Rebilly must be authorized to receive the credentials.

SecuritySecretApiKey or JWT
Request
Request Body schema: application/json

OAuth2 credential resource.

code
required
string

OAuth2 code provided by the authentication server.

scopes
required
Array of strings

List of URLs that are granted OAuth2 access.

service
required
string

Name of the service to which the OAuth2 credential relates.

Value: "google-sheets"
status
string

Status of the credential.

Enum: Description
active

Credential is active and can be used.

inactive

Credential is temporarily inactivated and cannot be used until reactivated.

deactivated

Credential is permanently deactivated and cannot be reactivated.

Responses
201

OAuth2 credential created.

Response Headers
Location
string <uri>

Location of the related resource.

Example: "https://api.rebilly.com/example"
Response Schema: application/json
code
required
string

OAuth2 code provided by the authentication server.

scopes
required
Array of strings

List of URLs that are granted OAuth2 access.

service
required
string

Name of the service to which the OAuth2 credential relates.

Value: "google-sheets"
hash
string <= 50 characters

Unique resource ID. Defaults to UUID v4.

status
string

Status of the credential.

Enum: Description
active

Credential is active and can be used.

inactive

Credential is temporarily inactivated and cannot be used until reactivated.

deactivated

Credential is permanently deactivated and cannot be reactivated.

deactivationTime
string <date-time>

Date and time when the credential is deactivated.

accessToken
string

OAuth2 access token.

refreshToken
string

OAuth2 refresh token.

Array of Self (object) non-empty

Related resource links.

Array (non-empty)
Any of:
href
required
string

Link URL.

rel
required
string

Type of link.

Value: "self"
401

Unauthorized access. Invalid credentials used.

403

Access forbidden.

422

Invalid data sent.

post/credential-hashes/oauth2
Request samples
application/json
{}
Response samples
application/json
{
  • "hash": "4f6cf35x-2c4y-483z-a0a9-158621f77a21",
  • "status": "active",
  • "deactivationTime": "2019-08-24T14:15:22Z",
  • "service": "google-sheets",
  • "code": "2/smAHUUr9jOxw_IOp47Y_dH1r2Y",
  • "accessToken": "zw34.PltIPtJZHmEgZS9R4RoGpzaRrJd5MYjZIONQ2MjWSCj7N7Iqp9BXXFIbkhDRfAPs6cB1pKtTjLUgb3ofzgHUprJfnRiMDTnB_yPMK7vtgobCX4SUs7fhrR6bdApq",
  • "refreshToken": "2/4DPERp2EiySF6JUIOTS4jM5f0JmLG2gPcpGaWYTGU94",
  • "_links": [
    ]
}