hilla react oauth2 logout

how do you logout hilla oauth2 application. i need a logout button in frontend

here is what i did sofar in der server i wrote a logout endpoint function.

@Endpoint
@PermitAll
public class AuthEndpoint {
    public void logout() {
        SecurityContextHolder.clearContext();
        System.out.println("server logout ...");
    }
}```

in Frontend 

const logoutAction = () => {
console.log(“react logout …”);
AuthEndpoint.logout();
}```

calling this give me 403 FORBIDDEN error in the browser. how will you trigger a logout from react.

The @hilla/frontend package includes a logout method you can call hilla-google-auth/frontend/useAuth.tsx at ff8c201840bcb270c4df68a5677c93f63a78835c · marcushellberg/hilla-google-auth · GitHub

That only closes the session on the server though. If you want to also log out of your SSO provider, you need to configure that in spring security

How do you trigger the SSO Provider logout. this is what i tried so far

http.oauth2Login().and()
                .logout()            .invalidateHttpSession(true)
.deleteCookies("JSESSIONID")              .logoutSuccessUrl("/").permitAll();```