Skip to content

Blockchain Auth API

The Auth API issues the authentication token required for using Hive Blockchain API and Blockchain Open API.

Issue authentication token

This API issues the authentication token required to use the 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 The ID value for issuing the authentication token string Y
secretKey The secret key required to use an API string Y

Responses

Field Name Description Type
code api request result code, 0: success number
message the result message string
data API Response json
data.accessToken The authentication token required to use an API string
data.refreshToken A token that is used to issue a new accessToken when the old accessToken is expired 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"
  }
}

Re-issue authentication token

It is an API that uses the refresh token issued with the previous authentication token to issue a new authentication token required to use the blockchain service APIs (Blockchain Open APIs, Hive Blockchain APIs) when the previous authentication token expired.

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 refreshToken required when calling an API string Y

Request body

There is no Request Body.

Response

Field Name Description Type
code api request result code, 0: success number
message the result message string
data API Response json
data.accessToken The authentication token required to use an API string
data.refreshToken A token that is used to issue a new accessToken when the old accessToken is expired 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"
  }
}