10

I have created a Twitter application and specified the following url as the callback url:

http://www.myapp.com/login

However, when a user comes to my site from the url myapp.com (missing the www prefix) the authentication fails.

Apparently, I cannot have multiple urls. So what can be a workaround?

George Eracleous
  • 4,278
  • 6
  • 41
  • 50
  • Gotta love the twitter oauth.. wasted a few days on their quirks. All other providers worked out of the box except twitter. And as soon as you think you got it all working and figured out it's a *knock, knock, whoisit, twitter quirk* situation all over again.. facepalm – tkit Jul 27 '16 at 14:43

1 Answers1

6

You can either

  1. Feed the correct OAuth URL by changing it based on the hostname the user uses to access your app.
  2. Implement a canonical domain name, making sure visitors are redirected to the www version (or vice versa).

No, you cannot feed multiple URLs to the OAuth service.

driis
  • 161,458
  • 45
  • 265
  • 341