Closed hpt123456 closed 1 year ago
Hey there, thanks for reporting this issue.
We'll need more info and/or code to debug this further. Can you please create a repository with the command below, commit the code that reproduces the issue as one separate commit on the main/master branch and share the repository here?
Please make sure that you have the latest version of the Laravel installer in order to run this command. Please also make sure you have both Git & the GitHub CLI tool properly set up.
laravel new bug-report --github="--public"
Do not amend and create a separate commit with your custom changes. After you've posted the repository, we'll try to reproduce the issue.
Thanks!
Hi @crynobone ,
Thanks for your help. I setup the project using docker. And I also included everything ready. You only need to run docker-compose up
and then you could call http://localhost/test in browser . Please let me know if you need another more.
@hpt123456 can you provide a link to a public repo?
@crynobone @driesvints
Sorry I thought link was included. Here is the link https://github.com/hpt123456/bug-report
I should see expires_at with some datetime value at personal_access_tokens table, Am I right?
No, the expiration is only used in below:
And validated against created_at
:
https://github.com/laravel/sanctum/blob/6bd2cc33a7951cf09be4fc394a5cb5fd9581804e/src/Guard.php#L159
You should be able to do it by using the following:
$token = $request->user()->createToken(
name: 'personal-token',
expiresAt: now()->addMinutes(30)
)->plainTextToken;
Sanctum Version
3.2
Laravel Version
10.10
PHP Version
8.2.8
Database Driver & Version
mariadb:10
Description
What I understand from documentation if I set
expiration' => 50000,
in cofig/sanctum.php file and I create below code in one of the controller method.$token = $request->user()->createToken('personal-token')->plainTextToken;
I should see expires_at with some datetime value at personal_access_tokens table, Am I right? But I got null. I could add that datetime value in expires_at column at **personal_access_tokens*** table by some ways. But, I would like to use from package if it already has that feature.
Steps To Reproduce
config/auth.php
config/sanctum.php
One of the controller method