Skip to content
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

Logout should be POST #6

Open
gogl92 opened this issue Dec 12, 2022 · 3 comments
Open

Logout should be POST #6

gogl92 opened this issue Dec 12, 2022 · 3 comments

Comments

@gogl92
Copy link

gogl92 commented Dec 12, 2022

I'm not sure about this but would the logout request should be a POST request?

Route::get('/logout', LogoutController::class)
    ->middleware('auth:sanctum')
    ->name('json-api-auth.logout');

To

Route::post('/logout', LogoutController::class)
    ->middleware('auth:sanctum')
    ->name('json-api-auth.logout');
@ArielMejiaDev
Copy link
Owner

Hi, @gogl92 it could be I just take in mind that there is no body required for the request and I took as an example the behavior of the framework when you make a GET request to /logout, if there are examples that make sense or a standard for this please add the links here to consider a change.

Thanks for using the package.

@gogl92
Copy link
Author

gogl92 commented Dec 12, 2022

Hi @ArielMejiaDev, it does make sense as there's no body but I see some people using POST or even DELETE as it theoretically you're deleting the tokens when you're logging out.

I connected my Laravel app to a react SPA using this package https:/koole/react-sanctum, by default the signOut method does POST https:/koole/react-sanctum/blob/master/src/Sanctum.tsx#L119 it's also not a big deal I can always change the method after the routes are generated, maybe if in the future more people request it.

@ArielMejiaDev
Copy link
Owner

I would search about it, if there are any standard for these... Incase you found something please feel free to make a PR

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

No branches or pull requests

2 participants