I want to have a capability in my application that allows users to Authorize Bitbucket. I have followed https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html.
The following works and brings the Bitbucket authorization screen as expected: https://bitbucket.org/site/oauth2/authorize?client_id={client_id}&response_type=code
However, this part emits an error about invalid Grant.
$ curl -X POST -u "client_id:secret" \ https://bitbucket.org/site/oauth2/access_token \ -d grant_type=authorization_code -d code={code} I am using request module in Node.js and using the code as follows:
request.post( 'https://bitbucket.org/site/oauth2/access_token', { json: { client_id: config.get('app.bitbucket_client_id'), client_secret: config.get('app.bitbucket_client_secret'), code: req.query.code, grant_type: "authorization_code" } }, function (error, response, body) { // Do something here } } {"result":{"error_description":"Unsupported grant type: None","error":"invalid_grant"}}
Please advice!