-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tokens list not displayed #85
Comments
if i get time i'll try and duplicate this but typically i have found is that if there are issues it is normally related to the sanctum configuration. if you can get me more details it might help me point you in the right direction |
Hi Jeff! Thanks for answering me. I believe i have a very straight-forward sanctum configuration but i'll gladly share whatever you think might guide us into a solution! Have a great weekend |
Hey @juanr-yes, Too late for party, but if anyone else will have this issue, check your network tab in developer tools - you should have something like: Check what is being returned there (I had 302 redirect), It should return JSON. If in routes configuration you have something like: Route::get('{any}', function () {
return redirect()->route('home');
})->where('any', '.*'); It overrides routes that are needed for this package (at least it was case for me). |
hi @kostamilorava , hope you are doing great. Thanks for your input, although im not sure we are talking about the same issues; i am looking at the network tab and the "sanctum-tokens" request and got a 200 response and, as stated in the beginning, the typeerror continues |
Alright, on fresh installed project, it seems to work properly. I checked the line where Vue throws that error, and I am pretty sure we are talking about same error, but just reason is different. Maybe you have some middleware that changes responses or wraps them. Vue is not able to iterate through tokens and produces that error. Do you have same structure as mine? Here is correct response (copied and pasted whole response) that works and may help you diagnose your problem: {
"id": 2,
"name": "IOT Device",
"email": "[email protected]",
"email_verified_at": null,
"created_at": "2023-08-20T20:37:57.000000Z",
"updated_at": "2023-08-20T20:37:57.000000Z",
"tokens": [
{
"id": 1,
"tokenable_type": "App\\Models\\User",
"tokenable_id": 2,
"name": "Name of token",
"abilities": [
"ability-name"
],
"last_used_at": "2023-08-22T10:11:08.000000Z",
"expires_at": null,
"created_at": "2023-08-21T18:36:33.000000Z",
"updated_at": "2023-08-22T10:11:08.000000Z"
}
]
} |
hey @kostamilorava , thanks a lot!! you're completely right about beign related to Vue not beign able to iterate the "tokens" property, which i whas hiding by not declaring it on $visible while on the model. Thanks to the repo owner as well. |
@JeffBeltran I ran into this issue, the reason was because I have a For now I've put this in my static::retrieved(function ($user) {
if (Request::is('nova-vendor/sanctum-tokens/*')) {
$user->makeVisible('tokens');
}
}); |
Hi! thanks in advance for this cool package and for the hard work.
I've trying to use it but seems like its having some issues:
Once i'm on the User resource and after inserting
SanctumTokens::make()
When i'm on the detail page and after creating a token, nothing gets displayed while i get a js error on the console:
TypeError: Cannot read properties of undefined (reading 'length')
even when the token has been successfully created.I'm on Laravel 8, Laravel Nova 4 and latest sanctum-tokens.
Looking forward to hear from you! Thanks again.
The text was updated successfully, but these errors were encountered: