-
-
Save zspine/6fcb2e05d097e1d6c928972a7fb654da to your computer and use it in GitHub Desktop.
API Platform json_login with separate domain SPA
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
APP_COOKIE_DOMAIN=.example.test | |
CORS_ALLOW_ORIGIN=^https?://app.example.test(:[0-9]+)?$ |
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
# config/packages/framework.yaml | |
framework: | |
session: | |
handler_id: null | |
cookie_domain: '%env(APP_COOKIE_DOMAIN)%' | |
cookie_secure: auto | |
cookie_samesite: lax |
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
# config/packages/nelmio_cors.yaml | |
nelmio_cors: | |
defaults: | |
allow_credentials: true #set to true | |
origin_regex: true | |
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%'] | |
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE'] | |
allow_headers: ['Content-Type', 'Authorization', 'Access-Control-Allow-Credentials', 'X-Auth-Token'] | |
expose_headers: ['Link'] | |
max_age: 3600 | |
paths: | |
'^/': null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment