Authentication
Authentication
In order to interact with the Twetch API, developers must obtain a Bearer token that is placed in the Header of subsequent HTTP requests like so:
Headers: {
Authorization: 'Bearer <twetch_authorization_token>'
}
HTTP GET request:
URL: https://auth.twetch.app/api/v1/challenge
Response:
{
message: <challenge_message_to_sign>
}
With a private key tied to a signing address setup in https://twetch.app/developer, sign the message recieved in the response.
HTTP POST request:
URL: https://auth.twetch.app/api/v1/authenticate
Headers: {
'Content-type': 'application/json'
}
body: {
address: <signing_address>
message: <challenge_response>
signature: <signature_of_challenge_response_with_private_key_tied_to_address>
}
Response:
{
token: <twetch_authorization_token>
}