akahu - v1.15.3 / AuthResource
Utilities for authorizing users using OAuth2.
https://developers.akahu.nz/docs/authorizing-with-oauth2
-
BaseResource
↳
AuthResource
▸ buildAuthorizationUrl(options
): string
Build the OAuth Authorization URL
Name | Type | Description |
---|---|---|
options |
Object |
Options for customising the generated URL. https://developers.akahu.nz/docs/authorizing-with-oauth2#the-authorization-request |
options.redirect_uri |
string |
Where to redirect the user once they have accepted or rejected the access request. This must match one of your app's Redirect URIs. |
options.response_type? |
string |
The type of OAuth response. Currently code is the only supported option. default code |
options.scope? |
string |
- |
options.email? |
string |
- |
options.connection? |
string |
- |
options.state? |
string |
- |
options.protocol? |
Protocol |
- |
options.host? |
string |
- |
options.port? |
number |
- |
options.path? |
string |
- |
string
▸ exchange(code
, redirect_uri
, grant_type?
): Promise
<AuthorizationToken
>
Exchange an OAuth authorization code for an access token.
https://developers.akahu.nz/docs/authorizing-with-oauth2#exchanging-the-authorization-code https://developers.akahu.nz/reference/post_token
Name | Type | Default value |
---|---|---|
code |
string |
undefined |
redirect_uri |
string |
undefined |
grant_type |
string |
"authorization_code" |
Promise
<AuthorizationToken
>
▸ revoke(token
): Promise
<void
>
Revoke the specified user auth token:
https://developers.akahu.nz/reference/delete_token
Name | Type |
---|---|
token |
string |
Promise
<void
>