Skip to content

Commit 4cb652e

Browse files
authored
Merge pull request #159 from oauth-xx/pboling/158-fix-readme-references
Fix references to consumer and access_token
2 parents cb9b9db + 176118d commit 4cb652e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

README.rdoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,28 @@ As a matter of fact it has been pulled out from an OAuth Rails GEM (https://ruby
2828

2929
We need to specify the oauth_callback url explicitly, otherwise it defaults to "oob" (Out of Band)
3030

31-
@callback_url = "http://127.0.0.1:3000/oauth/callback"
31+
callback_url = "http://127.0.0.1:3000/oauth/callback"
3232

33-
Create a new consumer instance by passing it a configuration hash:
33+
Create a new `OAuth::Consumer` instance by passing it a configuration hash:
3434

35-
@consumer = OAuth::Consumer.new("key","secret", :site => "https://agree2")
35+
oauth_consumer = OAuth::Consumer.new("key", "secret", :site => "https://agree2")
3636

3737
Start the process by requesting a token
3838

39-
@request_token = @consumer.get_request_token(:oauth_callback => @callback_url)
39+
request_token = oauth_consumer.get_request_token(:oauth_callback => callback_url)
4040

4141
session[:token] = request_token.token
4242
session[:token_secret] = request_token.secret
43-
redirect_to @request_token.authorize_url(:oauth_callback => @callback_url)
43+
redirect_to request_token.authorize_url(:oauth_callback => callback_url)
4444

4545
When user returns create an access_token
4646

4747
hash = { oauth_token: session[:token], oauth_token_secret: session[:token_secret]}
48-
request_token = OAuth::RequestToken.from_hash(@consumer, hash)
49-
@access_token = @request_token.get_access_token
48+
request_token = OAuth::RequestToken.from_hash(oauth_consumer, hash)
49+
access_token = request_token.get_access_token
5050
# For 3-legged authorization, flow oauth_verifier is passed as param in callback
51-
# @access_token = @request_token.get_access_token(oauth_verifier: params[:oauth_verifier])
52-
@photos = @access_token.get('/photos.xml')
51+
# access_token = request_token.get_access_token(oauth_verifier: params[:oauth_verifier])
52+
@photos = access_token.get('/photos.xml')
5353

5454
Now that you have an access token, you can use Typhoeus to interact with the OAuth provider if you choose.
5555

0 commit comments

Comments
 (0)