rupadana / filament-api-service

A simple api service for supporting filamentphp
https://filamentphp.com/plugins/rupadana-api-service
MIT License
121 stars 26 forks source link

[Bug]: Route [login] not defined when access to an entity route #15

Closed sambeauprak closed 8 months ago

sambeauprak commented 8 months ago

What happened?

I get the following error message : Route [login] not defined.

How to reproduce the bug

When I access to a route: e.g: api/admin/customers/1 I get an error message which implies the route login not defined.

Package Version

3.0

PHP Version

8.2.12

Laravel Version

10.35.0

Which operating systems does with happen with?

Windows

Notes

No response

rupadana commented 8 months ago

this package used laravel-sanctum enabled by default, when you did'nt adding Authorization header, you will directed to the login page.

Because of you did'nt use Laravel Auth, Laravel did'nt found the login page. You need modify route name on App\Http\Middleware\Authenticate to filament.admin.auth.login

to generate a token you can read this

sambeauprak commented 8 months ago

Hi there, I did what you said and it's okay for the login page. So I added a Bearer Token through Authorization header, but it still redirect me to the login page.

I used Postman for that. Here's the request URL: https://topizyv2.dev/api/admin/customers Here's the Authorization tab config: image

rupadana commented 8 months ago

Hi there, I did what you said and it's okay for the login page. So I added a Bearer Token through Authorization header, but it still redirect me to the login page.

I used Postman for that. Here's the request URL: https://topizyv2.dev/api/admin/customers Here's the Authorization tab config: image

i think you didn't copy all of the token showed cause its begin with "1|" the number is an ID of the token

sambeauprak commented 8 months ago

image I have this in my db. So as you said, my token should be 1|edf86e7c63001fd0e284b5ebb16b06a9107c725253050a62b069ba056f6dc1c5 ?

But I still get the login page.

image

rupadana commented 8 months ago

image I have this in my db. So as you said, my token should be 1|edf86e7c63001fd0e284b5ebb16b06a9107c725253050a62b069ba056f6dc1c5 ?

But I still get the login page.

image

In your database it is encrypted token, you need to copy the token from notification after you created token.

you need to back up it, because its only showed one time

sambeauprak commented 8 months ago

I got the same redirection to login page.

image

What's wrong? Did I miss any settings?

rupadana commented 8 months ago

I got the same redirection to login page.

image

What's wrong? Did I miss any settings?

Are you already checklist the abilities?

sambeauprak commented 8 months ago

image

I have these abilities checked

sambeauprak commented 8 months ago

I just needed to refresh migrations my db. Thanks for your help