Manually create client_secret in PHP for Laravel + OAUTH2

Asked

Viewed 84 times

1

Problem: I have an application with auto-installer. When the user sets up your account, I would like to manually register it in the table oauth_clients, already with a secret of his own.

If I do manual procedure by panel Laravel Passport and use the information, get my token smoothly.

If I do the procedure by entering through the database with a client_secret in MD5, just doesn’t work.

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

Does anyone know how?

Details: Running base of tests on PHP 7.1, Laravel 5.5.

1 answer

0

discovered by researching "in the gringa":

$secret = bin2hex(random_bytes(32));

UPDATE

The way above didn’t work, but the way below, yes:

$secret = base64_encode(hash_hmac('sha256',$password, 'secret', true));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.