R
R
Roman2019-09-07 14:50:12
API
Roman, 2019-09-07 14:50:12

I receive OAuth data from GitHub in Laravel, but what should I do next to make API authentication?

Here is the code:
app\Http\Controllers\Auth\LoginController.php

$user = Socialite::driver('github')->stateless()->user();
$token = $user->token;
dd(Socialite::driver('github')->userFromToken($token));

it gives me an object with data like: tokenand an array with a bunch of other data about the user, like him loginurlemail, etc.
But it does not write anything to the table users- should I do it myself?
In general, please advise what to read next in order to make a full-fledged authentication / authorization through the API based on this data.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Suha, 2019-09-07
@procode

should I do it myself?

Yes
How did I do if the registration was created manually by the user + created a table of user accounts with the fields user id network account id and wrote down the name of the resource through which the user registered on this resource. Then, during authorization, I simply checked whether there is an id in the table. Also note that a user with email may already be registered and for example a Facebook user may be registered via phone

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question