Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

about :callback_confirmed #3

Open
wants to merge 2 commits into from

1 participant

Richie Min
Richie Min

About sina weibo in China, They didn't return the :callback_confirmed when we get request token,
But is also need to varify the :oauth_verifier params at call back phase, so I made this patch so I can define it outside in the strategies.

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

Showing 2 unique commits by 1 author.

Dec 01, 2011
Richie Min mrichie Sina weibo does not returned :callback_confirmed params so make it ca…
…n defined in strategies.
395df01
Richie Min mrichie update README bf72047
This page is out of date. Refresh to see the latest.

Showing 2 changed files with 5 additions and 1 deletion. Show diff stats Hide diff stats

  1. +3 0  README.md
  2. +2 1  lib/omniauth/strategies/oauth.rb
3  README.md
Source Rendered
@@ -26,6 +26,9 @@ subclass it and add a few extra methods like so:
26 26 # initializing your consumer from the OAuth gem.
27 27 option :client_options, {:site => "https://api.somesite.com"}
28 28
  29 + # This is used for Sina weibo who didn't return :callback_confirmed params when get request token
  30 + option :callback_confirmed, true
  31 +
29 32 # These are called after authentication has succeeded. If
30 33 # possible, you should try to set the UID without making
31 34 # additional calls (if the user id is returned with the token
3  lib/omniauth/strategies/oauth.rb
@@ -15,6 +15,7 @@ class OAuth
15 15 option :read_timeout, 30
16 16 option :authorize_params, {}
17 17 option :request_params, {}
  18 + option :callback_confirmed, nil
18 19
19 20 attr_reader :access_token
20 21
@@ -28,7 +29,7 @@ def consumer
28 29 def request_phase
29 30 request_token = consumer.get_request_token({:oauth_callback => callback_url}, options.request_params)
30 31 session['oauth'] ||= {}
31   - session['oauth'][name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
  32 + session['oauth'][name.to_s] = {'callback_confirmed' => options[:callback_confirmed] || request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
32 33
33 34 if request_token.callback_confirmed?
34 35 redirect request_token.authorize_url(options[:authorize_params])

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.