Api
The endpoint for requesting a user's information after succesfully getting a login code (see Get Started), is justauthenticate.stevnbak.dk/api/auth/user.
This request must be a POST request anc the body must be in the valid format (see #Body below).
Body
The body of the request must contain a login code and a project secret in this format:
{
"code": string,
"secret": string
}
Overview of the properties:
- "code" is be the login code recieved after a user succesfully logs in, and will be a random 64 character hex string.
- "secret" is the project's secret, that can be optained through the dashboard, and will be a 128 character hex string.
An example body could look like this:
{
"code": "c2bb484ab3864c2e0b6918f56b4b44a2208c00beabc114540f5c5d62adc643ea",
"secret": "6ef87875ed029e69405716971c13df34b82a3c80c324a3ce0050503cf08d2f1c22ad6f04e4107d082802c9af7a145185060d8a1a8f80ad0c0e3854a3102a8732"
}
Return
The api will return a json object, that contains the user's information, in this format:
{
"user": {
"_id": string,
"username": string,
"email": string,
"avatar": string,
"verified": boolean,
"platform": string
}
}
Overview of the properties:
- "_id" is a 24 character string.
- "username" is the user's username.
- "email" is the user's email.
- "avatar" is a direct url to the user's avatar image file.
- "verified" is a boolean that describes if the platform determines the user to have verified their email.
- "platform" is a lowercase string of the platform the user authenticated with.
An example user object could look like this:
{
"user": {
"_id": "659835a51ea5db0d5f2124f7",
"username": "stevnbak",
"email": "user@example.com",
"avatar": "https://cdn.discordapp.com/avatars/avatar.png",
"verified": true,
"platform": "discord"
}
}