Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Cannot POST /dialog/authorize/decision" while implementing the OAuthorize example

I'm implementing OAuth 1.0a with the OAuthorize library. I'm following the example provided by the library.

I'm hosting my app at Heroku. Using the test client I'm able to GET a request token, and use it to /dialog/authorize:

Hi Bob Smith!

Samplr is requesting access to your account.

Do you approve?

When I press Allow, I get a Cannot POST /dialog/authorize/decision.

I've registered the endpoint in app.js:

app.post('/dialog/authorize/decision', oauth.userDecision);

Either I am missing something silly from the OAuthorize example or there is a fault in the way I'm handling the transaction.

dialog.ejs:

<form action="/dialog/authorize/decision" method="post">
  <input name="transaction_id" type="hidden" value="<%= transactionID %>">
  <div>
    <input type="submit" value="Allow" id="allow">
    <input type="submit" value="Deny" name="cancel" id="deny">
  </div>
</form>
like image 780
Sami N Avatar asked Nov 27 '25 16:11

Sami N


1 Answers

For me, the issue was that I didn't provide a proper callbackURL in server.userAuthorization callback.

see https://github.com/jaredhanson/oauthorize/blob/master/examples/express2/db/accessTokens.js#L10 and https://github.com/jaredhanson/oauthorize/blob/master/examples/express2/oauth.js#L152

like image 65
Vanuan Avatar answered Nov 30 '25 09:11

Vanuan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!