Migrasi autentikasi dari Bearer Token ke Sanctum Cookie-based - #17
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Revisi implementasi autentikasi dari Bearer Token ke Sanctum Cookie-based Session (SPA mode) sesuai ADR-006 dan OpenAPI contract v2.2 yang telah diupdate oleh BE. Perubahan ini adalah prerequisite sebelum AUTH-03 dan AUTH-04 bisa dikerjakan.
Jira Ticket
Ticket: -
Type of Change
Changes Made
src/types/auth.ts— hapus fieldtokendantoken_typedariLoginResponseDatadanAuthStatesrc/api/axiosInstance.ts— hapus interceptor Bearer Token; auth sepenuhnya dihandle via cookie danwithCredentials: truesrc/services/authService.ts— tambahinitCsrf()yang hitGET /sanctum/csrf-cookiesebelum register dan login; tambahVITE_API_BASE_URLuntuk base URL non-/apisrc/contexts/AuthContext.tsx— hapus token state; hanya simpanuserobject;isAuthenticatedderived dariuser !== nullsrc/tests/pages/RegisterPage.test.tsx— sesuaikan mock context dan payload assertion dengan contract v2.2src/tests/pages/LoginPage.test.tsx— sesuaikan mock context danmockLoginResponsedengan contract v2.2.env.example— tambahVITE_API_BASE_URLHow to Test
.env.exampleke.env.local, setVITE_API_URLdanVITE_API_BASE_URL/register, isi form, submit — verifikasi redirect ke/logindengan success message/login, login dengan credentials valid — verifikasi redirect ke/dashboardlaravel_sessiondanXSRF-TOKENter-set setelah loginnpm run testScreenshots (if applicable)
Checklist