laravel / sanctum

Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.
https://laravel.com/docs/sanctum
MIT License
2.75k stars 296 forks source link

Update from 2.x to 3.x - isValidBearerToken() - ctype_digit() #499

Closed EvodiaAut closed 8 months ago

EvodiaAut commented 8 months ago

Sanctum Version

3.3.3

Laravel Version

10.44

PHP Version

8.1

Database Driver & Version

No response

Description

Hi,

default the token look like 1|f4SwPYmyi0NPGkJn... <INT>|<STRING>

With Sanctum::usePersonalAccessTokenModel() i overwrite the function findToken() and change the $id from <INT> to a HashId <STRING>, now my token looks like 4EBNRJ9D|f4SwPYmyi0NPGkJn... <STRING>|<STRING>

Now I can't pass the function isValidBearerToken() (new i version 3.x). The function ctype_digit() return false with the value 4EBNRJ9D|f4SwPYmyi0NPGkJn... And get a HTTP Status 401 - "Unauthenticated"

Is it no longer possible to output the ID in the format if i want? Or how can I rewrite this function?

thx.

Steps To Reproduce

Change the token from 1|f4SwPYmyi0NPGkJn... to 4EBNRJ9D|f4SwPYmyi0NPGkJn... Change the format <INT>|<STRING> to <STRING>|<STRING>

driesvints commented 8 months ago

Hi there,

Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:

However, this issue will not be locked and everyone is still free to discuss solutions to your problem!

Thanks.