Authentication
Enabled by Default
By default, it is assumed that you want to use Authentication, which requires a single environment variable.
BHS_HTTP_AUTH_TOKEN=replace_me_with_token_you_want_to_use_as_admin_token
Disabling Auth Requirement
To disable authentication and expose all endpoints openly, set the following environment variable. This is available if you prefer to use your own authentication in a separate proxy or similar. We do not recommend you expose the server to the internet without authentication, as it would then be possible for anyone to prune your headers at will.
BHS_HTTP_USE_AUTH=false
Authenticate with admin token
After the setup of authentication you can use provided token to authenticate. To do it, just add the following header to all the requests to Block Headers Service.
Additional tokens
If you have a need for additional tokens to authenticate in Block Headers Service. you can generate such with the following request:
In response, you should receive something similar to the following:
Now, you can take the value from the 'token' property in the response and use it in all requests to the server by setting it as a header.
If at some point you want to revoke this additional token you can make a request:
After this request succeeded the token can't be used to authenticate in Block Headers Service.
Last updated