@synanetics/types
Version:
Common types for cross repository use
87 lines • 3.47 kB
TypeScript
/**
* A representation of the successful response from an OAuth 2.0 authorisation server, from:
* https://www.oauth.com/oauth2-servers/access-tokens/access-token-response/.
*/
export interface AccessTokenSuccessResponse {
/**
* The access token string as issued by the authorization server.
*/
access_token: string;
/**
* The type of token this is, typically just the string “Bearer”.
*/
token_type: string;
/**
* If the access token expires, the server should reply with the duration of time the access
* token is granted for.
*/
expires_in: number;
/**
* If the access token will expire, then it is useful to return a refresh token which
* applications can use to obtain another access token. However, tokens issued with the implicit
* grant cannot be issued a refresh token.
*/
refresh_token?: string;
/**
* If the scope the user granted is identical to the scope the app requested, this parameter is
* optional. If the granted scope is different from the requested scope, such as if the user
* modified the scope, then this parameter is required.
*/
scope?: string;
}
/**
* Access token error response reasons and their definitions.
*/
export declare enum AccessTokenErrorReason {
/**
* The request is missing a parameter so the server can’t proceed with the request. This may also
* be returned if the request includes an unsupported parameter or repeats a parameter.
*/
INVALID_REQUEST = "invalid_request",
/**
* Client authentication failed, such as if the request contains an invalid client ID or secret.
* Send an HTTP 401 response in this case.
*/
INVALID_CLIENT = "invalid_client",
/**
* The authorization code (or user’s password for the password grant type) is invalid or expired.
* This is also the error you would return if the redirect URL given in the authorization grant
* does not match the URL provided in this access token request.
*/
INVALID_GRANT = "invalid_grant",
/**
* For access token requests that include a scope (password or client_credentials grants), this
* error indicates an invalid scope value in the request.
*/
INVALID_SCOPE = "invalid_scope",
/**
* This client is not authorized to use the requested grant type. For example, if you restrict
* which applications can use the Implicit grant, you would return this error for the other apps.
*/
UNAUTHORIZED_CLIENT = "unauthorized_client",
/**
* If a grant type is requested that the authorization server doesn’t recognize, use this code.
* Note that unknown grant types also use this specific error code rather than using the
* `invalid_request` above.
*/
UNSUPPORTED_GRANT_TYPE = "unsupported_grant_type"
}
/**
* A representation of the error response from an OAuth 2.0 authorisation server, from:
* https://www.oauth.com/oauth2-servers/access-tokens/access-token-response/.
*/
export interface AccessTokenErrorResponse {
/**
* The coded reason that this authorisation request failed.
*/
error: AccessTokenErrorReason;
/**
* A detailed description of the error that occurred.
*/
error_description?: string;
/**
* A link to documentation that assists the user in resolving the error.
*/
error_uri?: string;
}
//# sourceMappingURL=accessToken.d.ts.map