Hi!

I am in the process of creating the oauth 2.0 bearer token following the steps twitter suggests:

  1. Login to your Twitter account on developer.twitter.com.
  2. Navigate to the [Twitter app dashboard] and open the Twitter app for which you would like to generate access tokens.
  3. Navigate to the “Keys and Tokens” page.
  4. You’ll find the “Consumer API keys” on this page.

I followed all these steps, but get stuck trying to generate the Bearer token. I use twurl to make the requests, but after entering

curl -u '<API key>:<API secret key>' \
  --data 'grant_type=client_credentials' \
  'https.\\api.twitter.com/oauth2/token'

(with and replaced with my login data )

I don’t receive the bearer token (as I should according to twitter), but the following :

Enter host password for user ''':
curl: (6) Could not resolve host:<API key>
curl: (6) Could not resolve host:<API secret key>
curl: (6) Could not resolve host: '\
C:\Users\<>  'https:\\api.twitter.com/oauth2/token'
Der Befehl "'https:" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

What am I doing wrong? Please help me!

Enter host password for user ‘’':

This seems like the command failed to parse the parameters appropriately. Also https.\\ is wrong.

I think since you’re running this in windows, you may have to modify the curl command - you may need to use " double quotes instead of single quotes ' and it may also help to get rid of the multi line. I don’t have windows to test but try

curl -u "aaaaaaaaakey:bbbbbbbbsecret" --data "grant_type=client_credentials" "https://api.twitter.com/oauth2/token"

(all in one line)

1 Like

Hey Igor,

I just tried the following curl command:

curl -u " aaaaaa : bbbbb " --data "grant_type=client_credentials" " https://api.twitter.com/oauth2/token "

(of course my key and secret were included) and received the following message:

{“errors”:[{“code”:99,“message”:“Unable to verify your credentials”,“label”:“authenticity_token_error”}]}

I also used a single line – it still didn’t work. What can I do now?

Best

Mona

I tried it with my keys and it worked, you would get the error if something else may be wrong - eg: including a white space before or after the keys, or a space anywhere else within the " quotes or leaving out : or accidentally pasting in the wrong key or something like that.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.