Permalink
Browse files

Merge pull request #161 from rafaelsachetto/master

access_token to external login by provider
  • Loading branch information...
2 parents 70441ef + a6a7992 commit daaeefc7501ce83e407677d1e96e927cd117476a @NoamB NoamB committed Nov 26, 2011
View
6 lib/sorcery/controller/submodules/external.rb
@@ -51,6 +51,12 @@ def login_from(provider)
user
end
end
+
+ # get provider access account
+ def access_token(provider)
+ @provider = Config.send(provider)
+ @provider.access_token
+ end
# this method automatically creates a new user from the data in the external user hash.
# The mappings from user hash fields to user db fields are set at controller config.
View
3 lib/sorcery/controller/submodules/external/providers/facebook.rb
@@ -36,7 +36,8 @@ class << self
:scope,
:user_info_mapping,
:display
-
+ attr_reader :access_token
+
include Protocols::Oauth2
def init
View
1 lib/sorcery/controller/submodules/external/providers/github.rb
@@ -36,6 +36,7 @@ class << self
:site,
:user_info_path,
:user_info_mapping
+ attr_reader :access_token
include Protocols::Oauth2
View
1 lib/sorcery/controller/submodules/external/providers/google.rb
@@ -37,6 +37,7 @@ class << self
:user_info_url,
:scope,
:user_info_mapping
+ attr_reader :access_token
include Protocols::Oauth2
View
1 lib/sorcery/controller/submodules/external/providers/liveid.rb
@@ -37,6 +37,7 @@ class << self
:user_info_url,
:scope,
:user_info_mapping
+ attr_reader :access_token
include Protocols::Oauth2
View
3 lib/sorcery/controller/submodules/external/providers/twitter.rb
@@ -37,7 +37,8 @@ class << self
:site,
:user_info_path,
:user_info_mapping
-
+ attr_reader :access_token
+
include Protocols::Oauth1
# Override included get_consumer method to provide authorize_path

0 comments on commit daaeefc

Please sign in to comment.