0

When I try to generate new access token in postman for twitter auth2.0. I get this error when I click on generat new token: enter image description here

I have tried many ways to resolve it but am still stuck.

1 Answers1

1

This steps will get an Access Token from Tweetter.

POST Endpoint

https://api.twitter.com/oauth2/token?grant_type=client_credentials

grant_type is client_credentials by query parameter

enter image description here

Authorization

Select Authorization tab

Select Basic Auth combo box

Enter Username with API Key

Enter Password with API Secret

enter image description here

Those two value from Tweeter Developer Dashboard's project

https://developer.twitter.com/en/portal/dashboard

enter image description here

Get Access Token

Finally, you can get the access token.

enter image description here

Assign Variable

If you want to using as variable of Postman, Add this code in Tests section for calling V2 API.

var jsonData = JSON.parse(responseBody);
console.log(jsonData)
postman.setEnvironmentVariable("access-token", jsonData.access_token);

console.log(postman.getEnvironmentVariable("access-token"))

enter image description here

Bench Vue
  • 5,257
  • 2
  • 10
  • 14