GrahamCampbell/Laravel-GitHub

How to use app authentication?

Closed this issue · 1 comments

Hi and thanks for the great package.

I am struggling to make app connection work. Is there any example?

I've configured this replacing with me app credentials

'app' => [
            'clientId'     => 'your-client-id',
            'clientSecret' => 'your-client-secret',
            'method'       => 'application',
],

But if I try to access private endpoints like $github->me()->repositories() I get

Github \ Exception \ RuntimeException (401)
Requires authentication

I guess with this auth method it will have to redirect you to Github OAuth page first, but I think this library does not handle that out of the box? In other words by using app auth, the user have to already granted permissions to the app?

Can you advise how to approach this in order to make it work or if I am missing something?

It would be nice to have this handled in the library itself, e.g. to generate OAuth url that I can redirect the user to, and also hooks to capture the auth action when it occurs.

Never mind, I think I've missed this https://laravel.com/docs/5.7/socialite