Skip to content

Commit

Permalink
Bugfix in getScopes() Bug in Query and Cast the Resultobjects to Arrays
Browse files Browse the repository at this point in the history
->join('oauth_scopes','oauth_session_token_scopes.session_access_token_id', '=', 'oauth_scopes.id')

to  

->join('oauth_scopes', 'oauth_session_token_scopes.scope_id', '=', 'oauth_scopes.id')

and cast the Object to an array, because in Resource the Function expects an Array and not an Object
  • Loading branch information
fx88 committed Oct 16, 2013
1 parent 4e4f1e0 commit d20ff61
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/LucaDegasperi/OAuth2Server/Repositories/FluentSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,18 @@ public function associateScope($accessTokenId, $scopeId)

public function getScopes($accessToken)
{
return DB::table('oauth_session_token_scopes')
->join('oauth_session_access_tokens', 'oauth_session_token_scopes.session_access_token_id', '=', 'oauth_session_access_tokens.id')
->join('oauth_scopes', 'oauth_session_token_scopes.session_access_token_id', '=', 'oauth_scopes.id')
->where('access_token', $accessToken)
->get();
$scope_query = DB::table('oauth_session_token_scopes')
->join('oauth_session_access_tokens', 'oauth_session_token_scopes.session_access_token_id', '=', 'oauth_session_access_tokens.id')
->join('oauth_scopes', 'oauth_session_token_scopes.scope_id', '=', 'oauth_scopes.id')
->where('access_token', $accessToken)
->get();

foreach($scope_query as $scope)
{
$scopes[]['scope'] = $scope->scope;
}

return $scopes;
}

public function associateAuthCodeScope($authCodeId, $scopeId)
Expand Down

0 comments on commit d20ff61

Please sign in to comment.