README.markdown in authlogic-connect-0.0.3.6 vs README.markdown in authlogic-connect-0.0.3.8

- old
+ new

@@ -35,11 +35,11 @@ gem "oauth2" gem "authlogic-connect" ### 2b. Add the `OpenIdAuthentication.store` -Do to "some strange problem":http://github.com/openid/ruby-openid/issues#issue/1 I have yet to really understand, Rails 2.3.5 doesn't like when `OpenIdAuthentication.store` is null, which means it uses the "in memory" store and for some reason fails. +Do to [some strange problem](http://github.com/openid/ruby-openid/issues#issue/1) I have yet to really understand, Rails 2.3.5 doesn't like when `OpenIdAuthentication.store` is null, which means it uses the "in memory" store and for some reason fails. So as a fix, add these at the end of your `config/environment.rb` files: In development mode: @@ -140,30 +140,41 @@ ### API User model has the following public accessors and methods. This example assumes: -# You've associated your Google, OpenID, and Twitter accounts with this app. -# You're currently logged in via Google. +- You've associated your Google, OpenID, and Twitter accounts with this app. +- You're currently logged in via Google. +Inside the `show` method in a controller... + def show @user = @current_user + puts @user.tokens #=> [ #<OpenidToken id: 12, user_id: 9, type: "OpenidToken", key: "http://my-openid-login.myopenid.com/", token: nil, secret: nil, active: nil, created_at: "2010-05-24 14:52:19", updated_at: "2010-05-24 14:52:19">, #<TwitterToken id: 13, user_id: 9, type: "TwitterToken", key: "my-twitter-id-123", token: "twitter-token", secret: "twitter-secret", active: nil, created_at: "2010-05-24 15:03:05", updated_at: "2010-05-24 15:03:05">, #<GoogleToken id: 14, user_id: 9, type: "GoogleToken", key: "my-email@gmail.com", token: "google-token", secret: "google-secret", active: nil, created_at: "2010-05-24 15:09:04", updated_at: "2010-05-24 15:09:04">] + puts @user.tokens.length #=> 3 + # currently logged in with... puts @user.active_token #=> #<GoogleToken id: 14, user_id: 9, type: "GoogleToken", key: "my-email@gmail.com", token: "google-token", secret: "google-secret", active: nil, created_at: "2010-05-24 15:09:04", updated_at: "2010-05-24 15:09:04"> + puts @user.authenticated_with #=> ["twitter", "openid", "google"] puts @user.authenticated_with?(:twitter) #=> true puts @user.authenticated_with?(:facebook) #=> false + puts @user.has_token?(:google) #=> true + puts @user.get_token(:google) #=> #<GoogleToken id: 14, user_id: 9, type: "GoogleToken", key: "my-email@gmail.com", token: "google-token", secret: "google-secret", active: nil, created_at: "2010-05-24 15:09:04", updated_at: "2010-05-24 15:09:04"> + # change active_token @user.active_token = @user.get_token(:twitter) puts @user.active_token #=> #<TwitterToken id: 13, user_id: 9, type: "TwitterToken", key: "my-twitter-id-123", token: "twitter-token", secret: "twitter-secret", active: nil, created_at: "2010-05-24 15:03:05", updated_at: "2010-05-24 15:03:05"> + + # access oauth api @twitter = @user.active_token @twitter_profile = JSON.parse(@twitter.get("/account/verify_credentials.json").body) #=> twitter api stuff # ... end @@ -171,11 +182,11 @@ If they've associated their Facebook account with your site, you can access Facebook data. def show @user = @current_user - token = @user.active_token + token = @user.active_token # assuming this is FacebookToken facebook = JSON.parse(token.get("/me")) @profile = { :id => facebook["id"], :name => facebook["name"], :photo => "https://graph.facebook.com/#{facebook["id"]}/picture", @@ -190,9 +201,13 @@ ### Oauth - Twitter - Facebook - Google +- LinkedIn +- MySpace +- Vimeo +- Yahoo ### OpenID - MyOpenID \ No newline at end of file