Commit 89469f715059c7d444440617ad0435426d83ad75

Authored by Victor Costa
1 parent fa2ddf48

oauth_provider: return user authenticated with oauth

plugins/oauth_client/lib/omniauth/strategies/noosfero_oauth2.rb
... ... @@ -20,10 +20,8 @@ module OmniAuth
20 20 end
21 21  
22 22 def raw_info
23   - #@raw_info ||= access_token.get('/api/v1/me.json').parsed
24   - #FIXME
25   - #raise access_token.inspect
26   - User['vfcosta'].attributes
  23 + #FIXME access the noosfero api (coming soon)
  24 + @raw_info ||= access_token.get('/plugin/oauth_provider/public/me').parsed
27 25 end
28 26 end
29 27 end
... ...
plugins/oauth_provider/controllers/public/oauth_provider_plugin_public_controller.rb 0 → 100644
... ... @@ -0,0 +1,10 @@
  1 +class OauthProviderPluginPublicController < PublicController
  2 +
  3 + doorkeeper_for :me
  4 +
  5 + def me
  6 + user = User.find(doorkeeper_token.resource_owner_id) if doorkeeper_token
  7 + render :json => {:id =>user.login, :email => user.email}.to_json
  8 + end
  9 +
  10 +end
... ...