You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bonsaiben edited this page Jun 19, 2012
·
7 revisions
Welcome to the oauth-plugin wiki!
A few resources that you might find useful while developing with this plugin. All 3 links contain small fixes I had to make to get this plugin to work correctly.
An Omniauth strategy for a provider made with this plugin:
require'omniauth/oauth'require'multi_json'moduleOmniAuthmoduleStrategiesclassActive < OAuth2definitialize(app,client_id=nil,client_secret=nil,options={}, &block)client_options={:site=>'http://localhost:3000',:authorize_path=>'/oauth/authorize',:access_token_path=>'/oauth/access_token'}super(app,:active,client_id,client_secret,client_options,options, &block)endprotected# customize this to return data on the user who has just logged in.defuser_data@data ||= MultiJson.decode(@access_token.get('/users/1.json'))['user']enddefauth_hashOmniAuth::Utils.deep_merge(super,{'uid'=>user_data['id'],'extra'=>{'user_hash'=>user_data}})endendendend