Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Improve external provider callbak_url #311

Merged
merged 2 commits into from Jun 20, 2012

Conversation

Projects
None yet
2 participants
Contributor

ppworks commented Jun 16, 2012

Hi, NoamB-san

Now, external_provider's callback_url setting should begin with http://...

# config/initializers/sorcery.rb
Rails.application.config.sorcery.configure do |config|
  ...
  config.twitter.callback_url = "http://0.0.0.0:3000/oauth/callback?provider=twitter"
  ...   
end

But, it's not DRY for example development and production.
My pull request could setting like follow.

# config/initializers/sorcery.rb
Rails.application.config.sorcery.configure do |config|
  ...
  # if url begin with /, callback to your http://yourhost + callback_url
  config.twitter.callback_url = "/oauth/callback?provider=twitter"
  ...   
end

It's inspired by omniauth.
https://github.com/intridea/omniauth/blob/master/lib/omniauth/strategy.rb#L397

NoamB added a commit that referenced this pull request Jun 20, 2012

Merge pull request #311 from ppworks/master
Improve external provider callbak_url

@NoamB NoamB merged commit 82a33bc into NoamB:master Jun 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment