ARTICLE AD BOX
I am trying to test my webhookController for data, approvals and to make account in database set to active. My problem is when I make trial subscriptions I get a 302 error (redirect). I have setup google Oauth and Spring security which I believe is blocking it. I have edited my SecurityConfig with the below snippet but it is not working. How can I get around this?
@Bean @Order(1) public SecurityFilterChain stripeWebhookChain(HttpSecurity http) throws Exception { http .securityMatcher("/stripe/webhook") .csrf(cs2 -> cs2.disable()) .authorizeHttpRequests(auth -> auth.anyRequest().permitAll()); return http.build(); }2
302 means Spring Security is redirecting Stripe to OAuth login.
Your securityMatcher("/stripe/webhook") likely isn’t matching, so the request falls into the authenticated chain.
Just permit the endpoint in your main config:
http.csrf(csrf -> csrf.ignoringRequestMatchers("/stripe/webhook")) .authorizeHttpRequests(auth -> auth .requestMatchers("/stripe/webhook").permitAll() .anyRequest().authenticated());Explore related questions
See similar questions with these tags.

