Commit 89469f715059c7d444440617ad0435426d83ad75
1 parent
fa2ddf48
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
oauth_provider: return user authenticated with oauth
Showing
2 changed files
with
12 additions
and
4 deletions
Show diff stats
plugins/oauth_client/lib/omniauth/strategies/noosfero_oauth2.rb
| @@ -20,10 +20,8 @@ module OmniAuth | @@ -20,10 +20,8 @@ module OmniAuth | ||
| 20 | end | 20 | end |
| 21 | 21 | ||
| 22 | def raw_info | 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 | end | 25 | end |
| 28 | end | 26 | end |
| 29 | end | 27 | end |
plugins/oauth_provider/controllers/public/oauth_provider_plugin_public_controller.rb
0 → 100644
| @@ -0,0 +1,10 @@ | @@ -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 |