mirror of
https://github.com/moghtech/komodo.git
synced 2026-04-29 21:27:26 -05:00
103 lines
2.3 KiB
Plaintext
103 lines
2.3 KiB
Plaintext
import Divider from '@site/src/components/Divider';
|
|
|
|
# login
|
|
|
|
monitor supports local login (username and password), Oauth2 login (github and google),
|
|
and secret login (username and API secret key).
|
|
each method must be explicitly enabled in your monitor core config,
|
|
otherwise the api won't be available.
|
|
|
|
:::note
|
|
in order to login to an Oauth2 user's account programmatically,
|
|
you must [create an api secret](/api/api-secrets#create-api-secret) and login using [/auth/secret/login](/api/login#login-using-api-secret)
|
|
:::
|
|
|
|
| name | route |
|
|
| ---- | ------ |
|
|
| [get login options](/api/login#get-login-options) | `GET /auth/options` |
|
|
| [create local user account](/api/login#create-local-user-account) | `POST /auth/local/create_user` |
|
|
| [login local user account](/api/login#login-local-user-account) | `POST /auth/local/login` |
|
|
| [login using api secret](/api/login#login-using-api-secret) | `POST /auth/secret/login` |
|
|
|
|
```mdx-code-block
|
|
<Divider />
|
|
```
|
|
|
|
## get login options
|
|
`GET /auth/options`
|
|
|
|
this method is used to obtain the login options for monitor core
|
|
|
|
### response body
|
|
```json
|
|
{
|
|
local: boolean,
|
|
github: boolean,
|
|
google: boolean,
|
|
}
|
|
```
|
|
|
|
```mdx-code-block
|
|
<Divider />
|
|
```
|
|
|
|
## create local user account
|
|
`POST /auth/local/create_user`
|
|
|
|
this method will create a new local auth account with the provided **username** and **password**,
|
|
and return a `JWT` for the user to authenticate with.
|
|
|
|
### request body
|
|
```json
|
|
{
|
|
username: string,
|
|
password: string,
|
|
}
|
|
```
|
|
|
|
### response body
|
|
`<JWT token as string>`
|
|
|
|
:::caution
|
|
a user created with this method is, by default, `disabled`. a monitor admin must enable their account before they can access the API.
|
|
:::
|
|
|
|
```mdx-code-block
|
|
<Divider />
|
|
```
|
|
|
|
## login local user account
|
|
`POST /auth/local/login`
|
|
|
|
this method will authenticate a local users credentials and return a JWT if login is successful.
|
|
|
|
### request body
|
|
```json
|
|
{
|
|
username: string,
|
|
password: string,
|
|
}
|
|
```
|
|
|
|
### response body
|
|
`<JWT token as string>`
|
|
|
|
```mdx-code-block
|
|
<Divider />
|
|
```
|
|
|
|
## login using api secret
|
|
`POST /auth/secret/login`
|
|
|
|
this method will authenticate a users account of any kind using an api secret generated using [/api/secret/create](/api/api-secrets#create-api-secret)
|
|
|
|
### request body
|
|
```json
|
|
{
|
|
username: string,
|
|
secret: string,
|
|
}
|
|
```
|
|
|
|
### response body
|
|
`<JWT token as string>` |