0

I'm using https://github.com/simov/grant to add login with Twitter feature, but for some reason twitter is failing to redirect back to my app after it authorises me.

Here's the url I'm providing for rederict:

enter image description here

I have dummy.com alias in my /etc/hosts file pointing to 127.0.0.1 (localhost)

Here's where I end up after twitter authorises me: enter image description here

If you look at browser address bar you'll notice that my url got corrupted (protocol part is missing) and looks like twitter is trying to find page with such url on twitter web site instead of actually redirecting to my url.

My grant config:

{ "twitter": { "key": "...", "secret": "....", "callback": "/handle_twitter_callback" } }

dKab
  • 2,658
  • 5
  • 20
  • 35
  • 1
    Add your Grant configuration to your post. – simo Mar 30 '17 at 21:09
  • It started to work when I added ` "server": { "protocol": "http", "host": "dummy.com:8080" }` to my grant config. – dKab Mar 30 '17 at 21:12
  • 1
    Yep, the `server` key is a special key used to configure a few things about the server. Take a look at the examples folder, there are lots of working examples there. – simo Mar 30 '17 at 22:23
  • Yeah, it's just I don't think it's mentioned in docs that "server" field is mandatory. – dKab Mar 31 '17 at 07:33
  • Generally speaking it's not mandatory, but it's good to have it anyway, bacause the `server` key contains some other valuable options. If you omit the server key then you have to specify the exact redirect uri in your provider's configuration using the `redirect_uri` key. Like for example: `redirect_uri: 'http://dummy.com:3000/connect/facebook/callback` I'll think about improving the docs about it. – simo Mar 31 '17 at 09:21

0 Answers0