Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't set scopes in the Oauth token table. #20

Closed
canemarcovaro opened this issue Feb 6, 2020 · 2 comments · Fixed by #30
Closed

I can't set scopes in the Oauth token table. #20

canemarcovaro opened this issue Feb 6, 2020 · 2 comments · Fixed by #30

Comments

@canemarcovaro
Copy link

canemarcovaro commented Feb 6, 2020

Hi comunity! The problem is when i want set a default scope in a new token thats come from google. I read the documentation from Socialite and and I don't know why it doesn't work.
The insertion in the database is done correctly but does not set the scope in the DB.

// AuthServiceProvider
use Laravel\Passport\Passport;

Passport::tokensCan([
    'place-orders' => 'Place orders',
    'check-status' => 'Check order status',
]);

Passport::setDefaultScope([
    'check-status',
    'place-orders',
]);
use Illuminate\Http\Request;

Route::get('/orders', function (Request $request) {
    if ($request->user()->tokenCan('place-orders')) {
        // not possible with social grant, but
       // but works well with password grant type
    }
});
@canemarcovaro
Copy link
Author

canemarcovaro commented Feb 6, 2020

my code:

  $providerUser = Socialite::driver($provider)->scopes(['normal-user'])->userFromToken($accessToken);

@hivokas
Copy link
Member

hivokas commented Mar 3, 2020

I believe this issue is not related to coderello/laravel-passport-social-grant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants