Search code examples
phphttp-redirectoauthlocalhostcoinbase-api

Coinbase OAuth works on localhost but not on live server


On my live server i'm getting a The redirect uri included is not valid. error message, whereas on my localhost OAuth works ok.

here's the full urls for both:

Localhost:

https://coinbase.com/oauth/authorize?response_type=code&client_id=xxx&redirect_uri=http%3A%2F%2Flocalhost%2Faccounts-coinbase%2Foauth&scope=balance+addresses+user+transactions

Live server (https://example.com)

https://coinbase.com/oauth/authorize?response_type=code&client_id=xxx&redirect_uri=https%3A%2F%2Fexample.com%2Faccounts-coinbase%2Foauth&scope=balance+addresses+user+transactions

I'm pretty confident I had the live server OAuth working before. Any ideas why it's failing now?


Solution

  • Ok I solved my own problem.

    The error message, The redirect uri included is not valid. does NOT accurately reflect the issue at all. What was actually the problem is that my Coinbase OAuth app had a localhost redirect url.

    The relevant OAuth redirect url, called a "callback url" is set from this rather hard to find page: https://coinbase.com/oauth/applications.

    There I just switched localhost with example.com and it worked.