Skip to content

Conversation

hafezdivandari
Copy link
Contributor

Closes #1860

This PR fixes an issue where the plain secret was not accessible after creating a new confidential client in ClientController::store, by appending the plain_secret attribute.

@hettiger Thanks!

hettiger and others added 2 commits October 10, 2025 19:34
…1745

```php
- if (Passport::$hashesClientSecrets) {
-     return ['plainSecret' => $client->plainSecret] + $client->toArray();
- }
+ $client->secret = $client->plainSecret;

return $client->makeVisible('secret');
```

This change obviously breaks usages that previously relied on the return type array with the additional 'plainSecret' data.
E.g., the old Vue components used the plainSecret to present that to the user so that he could save it, etc.
Since hashing is now mandatory, I restored the previous behavior without the now obsolete `Passport::$hashesClientSecrets` check:

```php
return ['plainSecret' => $client->plainSecret] + $client->toArray();
```

I also updated the tests. I know it looks a bit fishy but I had not much choice since it's a unit test … (didn't want to make too big of a change out of this … it's deprecated anyways …)
Copy link

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@hafezdivandari hafezdivandari changed the title [13.x] Fix accessing the plain secret after creating a new client on ClientController [13.x] Fix accessing the plain secret after creating a new confidential client via deprecated ClientController::store Oct 10, 2025
@hafezdivandari hafezdivandari marked this pull request as ready for review October 10, 2025 20:29
@taylorotwell taylorotwell merged commit 9feeb0c into laravel:13.x Oct 10, 2025
8 checks passed
@hafezdivandari hafezdivandari deleted the 13.x-fix-plain-secret branch October 10, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants