Class: Auth
Defined in: packages/api/src/lib/structures/http/Auth.ts:14
Constructors
Constructor
privatenew Auth(options:ServerOptionsAuth):Auth
Defined in: packages/api/src/lib/structures/http/Auth.ts:49
Parameters
| Parameter | Type |
|---|---|
options | ServerOptionsAuth |
Returns
Auth
Properties
#secret
private#secret:string
Defined in: packages/api/src/lib/structures/http/Auth.ts:47
cookie
cookie:
string
Defined in: packages/api/src/lib/structures/http/Auth.ts:25
The name for the cookie, this will be used to identify a Secure HttpOnly cookie.
Since
1.0.0
domainOverwrite
domainOverwrite:
null|string=null
Defined in: packages/api/src/lib/structures/http/Auth.ts:45
id
id:
string
Defined in: packages/api/src/lib/structures/http/Auth.ts:19
The client's application id, this can be retrieved in Discord Developer Portal at https://discord.com/developers/applications.
Since
1.0.0
redirect
redirect:
undefined|string
Defined in: packages/api/src/lib/structures/http/Auth.ts:37
The redirect uri.
Since
1.0.0
scopes
scopes: readonly
OAuth2Scopes[]
Defined in: packages/api/src/lib/structures/http/Auth.ts:31
The scopes defined at https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes.
Since
1.0.0
transformers
transformers:
LoginDataTransformer<LoginData>[]
Defined in: packages/api/src/lib/structures/http/Auth.ts:43
The transformers used for Auth.fetchData.
Since
1.4.0
Accessors
secret
Get Signature
get secret():
string
Defined in: packages/api/src/lib/structures/http/Auth.ts:63
The client secret, this can be retrieved in Discord Developer Portal at https://discord.com/developers/applications.
Since
1.0.0
Returns
string
Methods
decrypt()
decrypt(
token:string):null|AuthData
Defined in: packages/api/src/lib/structures/http/Auth.ts:83
Decrypts an object with aes-256-cbc to use as a token.
Parameters
| Parameter | Type | Description |
|---|---|---|
token | string | An data to decrypt |
Returns
null | AuthData
Since
1.0.0
encrypt()
encrypt(
data:AuthData):string
Defined in: packages/api/src/lib/structures/http/Auth.ts:72
Encrypts an object with aes-256-cbc to use as a token.
Parameters
| Parameter | Type | Description |
|---|---|---|
data | AuthData | An object to encrypt |
Returns
string
Since
1.0.0
fetchData()
Defined in: packages/api/src/lib/structures/http/Auth.ts:101
Retrieves the data for a specific user.
Parameters
| Parameter | Type | Description |
|---|---|---|
token | string | The access token from the user. |
Returns
Since
1.4.0
fetchInformation()
privatefetchInformation<T>(scope:OAuth2Scopes,token:string,url:string):Promise<undefined|null|T>
Defined in: packages/api/src/lib/structures/http/Auth.ts:124
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
scope | OAuth2Scopes |
token | string |
url | string |
Returns
Promise<undefined | null | T>
create()
staticcreate(options?:ServerOptionsAuth):null|Auth
Defined in: packages/api/src/lib/structures/http/Auth.ts:136
Parameters
| Parameter | Type |
|---|---|
options? | ServerOptionsAuth |
Returns
null | Auth