Authentication

You'll need to authenticate your requests to access any of the endpoints in the Pointhub API. In this guide, we'll look at how authentication works.

POST/v1/auth/signin

Local Authentication

This endpoint allows you to signin using username and password to get access token.

Required attributes

  • Name
    username
    Type
    string
    Description

    The username for the user.

  • Name
    password
    Type
    string
    Description

    The password for the user.

Request

POST
/v1/auth/signin
const response = axios.post('/v1/auth/signin', {
  username: "johndoe",
  password: "john1234"
})

Response

{
  "name": "john doe",
  "username": "johndoe",
  "email": "johndoe@example.com",
  "role": {
    "name": "admin",
    "permissions": ["user-create", "user-read", "user-update", "user-delete"]
  },
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
}
POST/v1/resources

Bearer Authentication

Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens.

Required headers

  • Name
    Authorization
    Type
    string
    Description

    Bearer token for the API request

Example

POST
/v1/resources
const response = axios.post('/v1/resources', {}, {
  headers: {
    Authorization: 'Bearer <accessToken>'
  }
})