Skip to content

Blockchain Auth API

The Auth API is an API that issues tokens required for authentication when using the Hive Blockchain API.

Authentication Token Issuance

This is an API that issues authentication tokens required for using blockchain service APIs.

Request URL

Live URL https://bc-platform-auth.withhive.com/v2/auth-token
Sandbox URL https://sandbox-bc-platform-auth.withhive.com/v2/auth-token
HTTP Method POST
Content-Type application/json

Request Body

Field Name Description Type Required
id ID to obtain the authentication token string Y
secretKey Secret key required for API usage string Y

Responses

Field Name Description Type
code API call result code, 0: success number
message Result message string
data API response value json
data.accessToken Authentication token required for API usage string
data.refreshToken Token that can be used to renew accessToken when it expires string

Request Sample

curl -X 'POST' 
  'https://sandbox-bc-platform-auth.withhive.com/v2/auth-token' 
  -H 'accept: */*' 
  -H 'Content-Type: application/json' 
  -d '{
  "id": "test",
  "secretKey": "1234"
}'

Response Sample

{
  "code": 0,
  "message": "success",
  "data": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20ydXMuYzJ4d2FsbGV0Lmdsb2JhbC5ub3JtYWwiLCJyb2xlIjoib3BlcmF0b3IiLCJhZGRyZXNzIjoieHBsYTE5cHdkYTJsdXQ5eGFlZnI4Z3NtZ2t0dXFldzkwc2M1YWpseGhrZyIsImlhdCI6MTY2NzM4MjY5NSwiZXhwIjoxNjY3NDY5MDk1fQ.xRq3ew5GAcn0zEcTEyRAXByjAbhgRQb3aWqaxy_iQ68",
    "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20ydXMuYzJ4d2FsbGV0Lmdsb2JhbC5ub3JtYWwiLCJyb2xlIjoib3BlcmF0b3IiLCJhZGRyZXNzIjoieHBsYTE5cHdkYTJsdXQ5eGFlZnI4Z3NtZ2t0dXFldzkwc2M1YWpseGhrZyIsImlhdCI6MTY2NzM4MjY5NSwiZXhwIjoxNjY3OTg3NDk1fQ.s8dL3tCwdbHUTQnWqAWbDSaGumKF3Jc_aYXVJUp1VxQ"
  }
}

Token Reissue

This is the API that issues the authentication token required to use the Hive blockchain API using the Refresh Token received along with the authentication token when it expires.

Request URL

Live URL https://bc-platform-auth.withhive.com/v2/refresh-token
Sandbox URL https://sandbox-bc-platform-auth.withhive.com/v2/refresh-token
HTTP Method POST
Content-Type application/json

Request Header

Field Name Description Type Required
Authorization The refreshToken required for API calls string Y

Response

Field Name Description Type
code API call result code, 0: success number
message Result message string
data API response value json
data.accessToken Authentication token required for API usage string
data.refreshToken Token that can be used to renew the accessToken when it expires string

Request Sample

curl -X 'POST' 
  'https://test-bc-platform-auth.withhive.com/v2/refresh-token' 
  -H 'accept: */*' 
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXlObyI6MSwiaWQiO...' 
  -d ''

Response Sample

{
  "code": 1000,
  "message": "success",
  "data": {
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20ydXMuYzJ4d2FsbGV0Lmdsb2JhbC5ub3JtYWwiLCJyb2xlIjoib3BlcmF0b3IiLCJhZGRyZXNzIjoieHBsYTE5cHdkYTJsdXQ5eGFlZnI4Z3NtZ2t0dXFldzkwc2M1YWpseGhrZyIsImlhdCI6MTY2NzQ3MTIwMSwiZXhwIjoxNjY3NTU3NjAxfQ.icFnROeEU7RI0FvEdPR5Oa26YqEihwcBN-KT_n_iq_o",
    "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6ImNvbS5jb20ydXMuYzJ4d2FsbGV0Lmdsb2JhbC5ub3JtYWwiLCJyb2xlIjoib3BlcmF0b3IiLCJhZGRyZXNzIjoieHBsYTE5cHdkYTJsdXQ5eGFlZnI4Z3NtZ2t0dXFldzkwc2M1YWpseGhrZyIsImlhdCI6MTY2NzQ3MTIwMSwiZXhwIjoxNjY4MDc2MDAxfQ.fclh8qVxLRG0Z1Fn2KRtW7Dmm6KFY5H4jvRSroy-mag"
  }
}