Create client_secret manually in PHP for Laravel + OAUTH2

0

Problem: I have an application with auto installer. When the user sets up their account, I would like to manually register it in the oauth_clients table, with a secret only from it.

If I do the manual procedure through the Laravel Passport dashboard and use the information, I get my token with no problems.

If I do the procedure inserting by the database with a client_secret in MD5, it just does not work.

Something tells me that the client_secret needs to be created exactly in a certain way.

Does anyone know how?

Details: Running test database in PHP 7.1, Laravel 5.5.

    
asked by anonymous 13.03.2018 / 18:25

1 answer

0

I discovered searching "in gringa":

$secret = bin2hex(random_bytes(32));

UPDATE

As above did not work, but as below, yes:

$secret = base64_encode(hash_hmac('sha256',$password, 'secret', true));
    
13.03.2018 / 18:31