G
G
Gleb Starkov2021-01-19 13:00:28
PHP
Gleb Starkov, 2021-01-19 13:00:28

How to authenticate user in github api?

Hello!
Created an application in Github Apps.
A user from my site can connect via Github.
At the same time, I get the following data:
- token
- refreshToken
- expiresIn
- id
- nickname
- name
- email
- avatar
- and many more in the user parameter

I need to be able to add (for example) a new issue on behalf of the user, this requires user authentication .

I use this library: php-github-api authentification

I tried to authenticate like this:

$client->authenticate($user->github_token, null, Client::AUTH_CLIENT_ID);


does not work.

How can I authenticate it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gleb Starkov, 2021-01-27
@colonel

This is how it happened:

$client->authenticate($user->github_token, Client::AUTH_ACCESS_TOKEN);

Only tokens expire after 8 hours and need to be refreshed using refresh_token

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question