Builtin api endpoints - aPisC/phroper GitHub Wiki

Auth

Login

Generating a jwt token for the user authenticated by credentials.

URL : /api/auth/login
Method : POST
Auth required : NO
Permissions required : post.auth.login

Request body

{
    "username": "admin",
    "password": "admin"
}

Success Response

Code: 200

{
    "user": {
        "id": 1,
        "created_at": "2021-04-26 13:17:14",
        "updated_at": "2021-04-26 13:17:14",
        "username": "admin",
        "role": 1,
        "email": "",
        "isAdmin": true
    },
    "jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyaWQiOjEsImV4cCI6MTYxOTYzODUxMn0.3v2pgxGCiYR_uXSKaCJIglScFT4aK3t2PSQv_CIG2qM"
}
Register

Registering a new user

URL : /api/auth/register
Method : POST
Auth required : NO
Permissions required : post.auth.register

Request body

{
    "username": "admin",
    "email": "[email protected]"
    "password": "admin"
}

Success Response

Code: 200

{
    "user": {
        "id": 1,
        "created_at": "2021-04-26 13:17:14",
        "updated_at": "2021-04-26 13:17:14",
        "username": "admin",
        "role": 1,
        "email": "",
        "isAdmin": true
    },
    "jwt": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyaWQiOjEsImV4cCI6MTYxOTYzODUxMn0.3v2pgxGCiYR_uXSKaCJIglScFT4aK3t2PSQv_CIG2qM"
}
Me

Gets the data of the current user

URL : /api/auth/me
Method : GET
Auth required : YES
Permissions required : get.auth.me

Success Response

Code: 200

{
    "user": {
        "id": 1,
        "created_at": "2021-04-26 13:17:14",
        "updated_at": "2021-04-26 13:17:14",
        "username": "admin",
        "role": 1,
        "email": "",
        "isAdmin": true
    }
}
⚠️ **GitHub.com Fallback** ⚠️