SwissPass
SwissPass provider allows users to login with their SwissPass account.
Configuration
To be able to use this provider, you need to set environment variables in your .env.local file.
SWISSPASS_OAUTH_CLIENT_ID=
SWISSPASS_OAUTH_URL=
SWISSPASS_OAUTH_REDIRECT_URL=
Events
The following events are emitted:
- CustomerBeforeLogoutEvent - this event is emitted before the user is logged out. CustomerBeforeLogoutSubscriber listener is used to revoke the SwissPass token.
- UpdateUserToStoremanagerEvent- this event is emmited after the user is registered to create and Address in SM. It is also emitted when the user logs in and when
swisspass/statusorswisspass/tokenroutes are called to update SP token. CustomerUpdateStoremanagerSubscriber listener is used to update the user's data in the StoreManager.
Routes
The following routes are available:
GET /login/swisspass
Redirects the user to SwissPass login page.
- body: none
- query: none
- response: redirect
GET /login/swisspass/redirect
Callback for SwissPass login. This route should be used as the redirect URL in the SwissPass configuration. After successful login, the user will be redirected to the profile page.
- body: none
- query:
- code: string
- state: string
- response: redirect
- emits: UpdateUserToStoremanagerEvent
GET /store-api/swisspass/status
Checks if the user's SwissPass token is still valid or is expired. If the token is expired, system will try to get a new one with the refresh token. If the refresh token is invalid as well, the user will be logged out.
- body: none
- query: none
- response:
- 200 - token is valid or was refreshed
- 403 - token is expired
- emits: UpdateUserToStoremanagerEvent
GET /store-api/swisspass/token
Returns the user's SwissPass token. Does the same checks as the status route above.
- body: none
- query: none
- response:
- 200 - token is valid or was refreshed
- token: string
- 403 - token is expired
- 200 - token is valid or was refreshed
- emits: UpdateUserToStoremanagerEvent