Good question! According to OAuth website, you can login with "password" grant_type, without CLIENT_SECRET.
https://oauth.net/articles/ =>> OAuth-2-Simplified
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a few questions regarding Passport's "Password Grant Tokens" that I am hoping someone can answer. I will start by explaining what I am attempting to do.
We are in the process of refactoring our existing laravel web application into a service oriented architecture that will be consumed by a web browser using javascript and vuejs for templating. The api will contain public endpoints, and private endpoints. To secure the private endpoints we have decided to use OAuth2 via Laravel's Passport package.
Our current application uses laravel's standard authentication flow (user provides email/password, web app verifies, creates session, and sends session id in cookie). We will require the same functionality moving forward, except instead of creating a session, issuing an access_token to the user to be used during subsequent requests.
After days of researching OAuth2 (and reading a book!...yeah a book!) I am still semi-confused as to how this should be implemented. From what I have read, it would seem that in order to authenticate a user from our javascript web application we would want to use the "Password Grant Tokens" functionality of passport. If this is so, I have the following questions:
$response = $http->post('http://your-app.com/oauth/token', [
'form_params' => [
'grant_type' => 'password',
'client_id' => 'client-id',
'client_secret' => 'client-secret',
'username' => '[email protected]',
'password' => 'my-password',
'scope' => '',
],
]);
Some of these questions I am sure come from my lack of experience with OAuth. If someone could be kind enough to fill in the gaps I'm missing, I would be more than grateful.
If I have been unclear about what I am asking, or if further explanation is required just ask, as I will be more than happy to provide additional details.
Please or to participate in this conversation.