Cognito Gateway API
Usage
; const signIn signUp signOutGlobal signUpConfirm signUpConfirmResend refreshToken changePassword forgotPasswordRequest forgotPasswordConfirm userGet userDelete } from ;
Config
headers
: Object<string, string>
An object containing any headers to be added to the http response.
Hooks
Hooks are called at various points throughout the signup and authentication process. They can be used to add custom authentication or perform additional actions in response to authentication or signup. All hooks are async so you can return a promise. The promise should resolve to an object in the same structure as the request or response body. If the promise is rejected or an error is thrown during the hook execution then cognitoGateway will create a http response from the err.statusCode
and err.message
properies of the promise rejection payload or thrown error.
The available hooks are:
Promise<requestBody> Promise<responseBody> Promise<requestBody> Promise<responseBody> Promise<requestBody> Promise<responseBody> Promise<requestBody> Promise<responseBody> Promise<requestBody> Promise<responseBody> Promise<requestBody> Promise<responseBody> Promise<requestBody> Promise<responseBody> Promise<requestBody> Promise<responseBody> Promise<requestBody> Promise<responseBody> Promise<requestBody> Promise<responseBody> Promise<requestBody> Promise<responseBody>
Auth
/signIn [post]
Request a set of tokens via a username and password
path: /signInmethod: postrequestBody: username: string password: stringresponseBody: accessToken: string refreshToken: string idToken: string time: int
/refreshToken [post]
Request a new access and id token via a refresh token
path: /refreshTokenmethod: postrequestBody: refreshToken: stringresponseBody: accessToken: string idToken: string
/signOutGlobal [post]
Sign a user out from all services.
path: /signOutGlobalmethod: postheaders: Authorization: 'Bearer {accessToken}'responseBody: status: string
/signUp [post]
Request the creation of a new user
path: /signUpmethod: postrequestBody: username: string password: string attributes: arrayresponseBody: user: cognitoUser verificationAttribute: string verificationMedium: string verificationValue: string
/signUpConfirm [post]
Confirm a user via a verification code
path: /signUpConfirmmethod: postrequestBody: username: string verificationCode: stringresponseBody: status: string
/signUpConfirmResend [post]
Request a new verification code via username
path: /signUpConfirmResendmethod: postrequestBody: username: stringresponseBody: verificationAttribute: string verificationMedium: string verificationValue: string
Users
/user [get]
Request user information via a token
path: /usermethod: getheaders: Authorization: 'Bearer {accessToken}'responseBody: CognitoUser
/user [delete]
Delete a user via a token
path: /usermethod: deleteheaders: Authorization: 'Bearer {accessToken}'responseBody: status: string