Skip to content

Commit 9f7966f

Browse files
committed
Update README.rdoc to store tokens in session
Storing variables in sessions is not the proper way. Updating to store only token and secret in session.  Code is tested.
1 parent e04ce11 commit 9f7966f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.rdoc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,15 @@ Create a new consumer instance by passing it a configuration hash:
3131
Start the process by requesting a token
3232

3333
@request_token = @consumer.get_request_token(:oauth_callback => @callback_url)
34-
session[:request_token] = @request_token
34+
35+
session[:token] = request_token.token
36+
session[:token_secret] = request_token.secret
3537
redirect_to @request_token.authorize_url(:oauth_callback => @callback_url)
3638

3739
When user returns create an access_token
3840

41+
hash = { oauth_token: session[:token], oauth_token_secret: session[:token_secret]}
42+
request_token = OAuth::RequestToken.from_hash(@consumer, hash)
3943
@access_token = @request_token.get_access_token
4044
@photos = @access_token.get('/photos.xml')
4145

@@ -72,4 +76,4 @@ This code is free to use under the terms of the MIT license.
7276
OAuth Ruby has been created and maintained by a large number of talented individuals.
7377
The current maintainer is Aaron Quint (quirkey).
7478

75-
Comments are welcome. Send an email to via the OAuth Ruby mailing list http://groups.google.com/group/oauth-ruby
79+
Comments are welcome. Send an email to via the OAuth Ruby mailing list http://groups.google.com/group/oauth-ruby

0 commit comments

Comments
 (0)