spring-attic / spring-social-samples

Samples of using Spring Social
http://projects.spring.io/spring-social
Apache License 2.0
531 stars 811 forks source link

How to redirect back to website? #72

Open ghost opened 6 years ago

ghost commented 6 years ago

I am trying to implement this example on my server but the problem is that I'm having a slightly different setup.

I am having a website on (client) https://localhost:4200 which talks to the REST API on (server) https://localhost:8443.

One of my problems at the moment is that the last redirect will be back to (server) https://localhost:8442 and not to the calling website.

What I see is that after authorization the endpoint /signup is getting called:

@RequestMapping(value = "/signup", method = RequestMethod.GET)
public SignUpForm signupForm(WebRequest request) {
    Connection<?> connection = providerSignInUtils.getConnectionFromSession(request);
    if (connection != null) {
        request.setAttribute("message", new Message(MessageType.INFO, "Your " + StringUtils.capitalize(connection.getKey().getProviderId()) + " account is not associated with a Spring Social Showcase account. If you're new, please sign up."), WebRequest.SCOPE_REQUEST);
        return SignUpForm.fromProviderUser(connection.fetchUserProfile());
    } else {
        return new SignUpForm();
    }
}

and for some reason after finishing this call, the web client gets redirected to (server) https://localhost:8443/signup

Anyway, is there a way to extend https://github.com/spring-projects/spring-social-samples or is there any example out there with a similar setup than mine? I'm looking for quite a while now but I'm stuck.

Btw I am having this question on stackoverflow in case somebody can help here.