Skip to content

fix: OAuth2 callback, CORS, and WebSocket connection issues#16

Merged
Mathieu-bot merged 3 commits into
preprodfrom
fix/oauth2-cors-websocket
Apr 4, 2026
Merged

fix: OAuth2 callback, CORS, and WebSocket connection issues#16
Mathieu-bot merged 3 commits into
preprodfrom
fix/oauth2-cors-websocket

Conversation

@Mathieu-bot

Copy link
Copy Markdown
Owner

Summary

  • Fix OAuth2 login flow by redirecting browser to Spring Security endpoint instead of using POST callback
  • Add CORS configuration in SecurityFilterChain to allow frontend origins (localhost:5173) with credentials
  • Allow /ws/** endpoints for WebSocket handshake
  • Redirect to frontend after OAuth2 success and logout

Changes

  1. SecurityConfig.java: Added CORS source bean, allowed /ws/**, configured OAuth2 success/logout redirects to frontend
  2. application.yml: Added localhost:5173 to default CORS origins
  3. CorsConfigurer.java: Updated default origins to include localhost:5173

Testing

  • OAuth2 Google login now redirects correctly to frontend after authentication
  • CORS headers properly set for API requests from localhost:5173
  • WebSocket STOMP connections work with SockJS fallback

…frontend

- Configure CORS directly in SecurityFilterChain with credentials support
- Allow /ws/** endpoints for WebSocket handshake
- Add defaultSuccessUrl redirect to frontend after OAuth2 login
- Add logoutSuccessUrl redirect to frontend login page

@Mathieu-bot Mathieu-bot left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@Mathieu-bot Mathieu-bot merged commit a7e7fa2 into preprod Apr 4, 2026
2 of 3 checks passed
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

Successfully merging this pull request may close these issues.

1 participant