suvanl / delet3

delet³ - Discord bot. Currently in alpha.
http://delet3.web.app
MIT License
6 stars 0 forks source link

comment #34

Closed oodvg closed 3 years ago

oodvg commented 3 years ago

Hey Suvanl,

Looking good so far!

quick question, what is the REST API port, REST API base URL, REST API login, and JWT secret for?

suvanl commented 3 years ago

Hey!

delet3 uses MongoDB for storing two main types of data. These are:

To access the MongoDB database, a REST API is used. This API's endpoint will be set up on the specified URL with a port appended to it (REST API base URL), e.g. in the format http://localhost:1234.

Technically, the REST API port environment variable is redundant as the port is already specified in the base URL. This redundancy will be rectified soon. For now, you just need to specify the same port number that's in the base URL.

To actually make requests via the API, an "API user" must log in with their username and password. This user will then receive an authentication token that they must pass in with each request to the API. This is a security measure to prevent any old person from requesting guild/user data from the database via the API. Sending a request without an auth token returns an error message.

Therefore, the REST API login is the aforementioned username and password, and the JWT secret is essentially a secure hash that's used in the generation of the auth token. JWT stands for JsonWebToken.

If there's anything that's still unclear, just let me know!

oodvg commented 3 years ago

I think I understand now. thanks!

suvanl commented 3 years ago

Awesome, glad to hear that!