tallgreentree / omniauth-37signals

37signals OAuth2 Strategy for Omniauth 1.0
16 stars 17 forks source link

Correct redirect URI? #1

Open moneill opened 12 years ago

moneill commented 12 years ago

Will,

Wondering if you can help me with what is surely a simple oversight on my part. I am using the latest versions of Devise, Omniauth, and your gem, all pulled from their respective github repos.

I seem to have the strategy properly declared in devise.rb

config.omniauth "37signals", CLIENTID, SECRET

When a user tries to authenticate using 37signals, the handoff to 37signals occurs, but the page is blank. It looks like an issue with the "Redirect URI" that I have to specify when registering my app https://integrate.37signals.com. What's the correct callback URL here? I currently have http://myapp.ext/users/auth/thirty_seven_signals/callback

I assume that the omniauth-37signals gem actually expects http://myapp.ext/users/auth/37signals/callback as the callback URL, but wouldn't that require a 37signals method in OmniauthCallbacksController? (The problem being that 37signals is not a valid method name.)

Really appreciate all of the work you've put in to this. I'm migrating from older versions of Devise and Omniauth (which included the "thirty_seven_signals" strategy), so I assume I have just overlooked something in the process.

Thanks! Mike

tallgreentree commented 12 years ago

Mike,

I'm all tied up until this evening, but I'll do my best to get you a workaround today.

Will

moneill commented 12 years ago

Will,

Just thought I'd follow up to see if you had a chance to take a look at the above. Again, I'm pretty damn sure I am missing something completely obvious!

Thanks! Mike

tallgreentree commented 12 years ago

Mike,

Sorry for the delay. I hope this helps:

The gem expects

http://myapp.ext/users/auth/37signals/callback
. For use with Devise, you'll need to override the default Devise routing. Go ahead and add this to your routes file:

devise_scope :user do
  get "auth/37signals/callback", :to => "users/omniauth_callbacks#thirty_seven_signals"
end

That should route the url to the thirty_seven_signals function in OmniauthCallbacksController. You may need to play with the order of your routes to get this to work - this route needs to be higher priority than the normal devise + omniauth routes. Let me know if this gets you closer to resolving the problem. If so, I'll add it to the README.

Will

moneill commented 12 years ago

Will,

Yep, that should do it. I created a fork and actually changed the name of strategy (to "thirty_seven_signals") so I could drop it straight in to our existing app in place of the old Omniauth-supplied 37signals strategy. This approach worked perfectly, but I'll try the above and report back. Would be preferable to switch away from maintaining a separate fork.

Thanks! Mike

moneill commented 12 years ago

Will,

Just to keep you in the loop--I'm still having some issues, so I am going to try to set up a simple Rails app and start from scratch. Some of our ongoing issues may be related to Devise or something else in our existing app.

Mike

tallgreentree commented 12 years ago

Thanks Mike. Keep me in the loop and I'll do my best to help you out. Devise can be a real pain sometimes - it makes so many assumptions.