Class: Auth
api/src.Auth
Constructors
constructor
• Private
new Auth(options
)
Parameters
Name | Type |
---|---|
options | ServerOptionsAuth |
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:48
Properties
#secret
• Private
#secret: string
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:46
cookie
• cookie: string
The name for the cookie, this will be used to identify a Secure HttpOnly cookie.
since
1.0.0
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:24
domainOverwrite
• domainOverwrite: null
| string
= null
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:44
id
• id: string
The client's application id, this can be retrieved in Discord Developer Portal at https://discord.com/developers/applications.
since
1.0.0
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:18
redirect
• redirect: undefined
| string
The redirect uri.
since
1.0.0
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:36
scopes
• scopes: readonly string
[]
The scopes defined at https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes.
since
1.0.0
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:30
transformers
• transformers: LoginDataTransformer
<LoginData
>[]
The transformers used for Auth.fetchData.
since
1.4.0
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:42
Accessors
secret
• get
secret(): string
The client secret, this can be retrieved in Discord Developer Portal at https://discord.com/developers/applications.
since
1.0.0
Returns
string
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:62
Methods
decrypt
▸ decrypt(token
): null
| AuthData
Decrypts an object with aes-256-cbc to use as a token.
since
1.0.0
Parameters
Name | Type | Description |
---|---|---|
token | string | An data to decrypt |
Returns
null
| AuthData
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:84
encrypt
▸ encrypt(data
): string
Encrypts an object with aes-256-cbc to use as a token.
since
1.0.0
Parameters
Name | Type | Description |
---|---|---|
data | AuthData | An object to encrypt |
Returns
string
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:72
fetchData
▸ fetchData(token
): Promise
<LoginData
>
Retrieves the data for a specific user.
since
1.4.0
Parameters
Name | Type | Description |
---|---|---|
token | string | The access token from the user. |
Returns
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:102
fetchInformation
▸ Private
fetchInformation<T
>(scope
, token
, url
): Promise
<undefined
| null
| T
>
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
scope | string |
token | string |
url | string |
Returns
Promise
<undefined
| null
| T
>
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:121
create
▸ Static
create(options?
): null
| Auth
Parameters
Name | Type |
---|---|
options? | ServerOptionsAuth |
Returns
null
| Auth
Defined in
projects/plugins/packages/api/src/lib/structures/http/Auth.ts:133