POST: https://survey2connect.com/v2/api/oauth/token
"Content-Type": "application/json"
Request Body
{ "email": "john@survey2connect.com", "password": "Survey@123" }
Request Sample
curl --location --request POST 'https://survey2connect.com/v2/api/oauth/token' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "john@survey2connect.com",
"password": "Survey@123"
} '
var myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); var raw = JSON.stringify({ "email": " john@survey2connect.com ", "password": " Survey@123 " }); var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("https://survey2connect.com/v2/api/oauth/token", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
Responses
{ "access_token": "eyJraWQiOiJzM3E1OWF2cFdIcXVKa0I0MjRpcFpqQVN0dXAzQzFkZEhVM3k2TjNZSXRjPSIsImFs", "token_type": "bearer", "expires_in": 86400, "refresh_token": "eyJjdHkiOiJKV1QiLCJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiUlNBLU9BRVAifQ.cDxAdRucchD9kzma3", "created_at": 1633160039478 }
{ "error": { "name": "Bad Request", "message": "Email is required" } }
{ "error": { "name": "Not Found", "message": "User not found" } }
{ "error": { "name": "Internal Server Error", "message": "We were not able to process your request" } }
Note: Please do not share your tokens in publicly accessible areas or to anyone. Also, this token generated is valid for 24 hours only. After its expiry, you can regenerate the access token from the same API endpoint by passing the username and password or from the refresh token API with the help of refresh token.