0

action="/signin/facebook" method="POST"spring docs で指定されているように、シンプルを使用して、Spring Boot アプリケーションに Facebook でのログインを実装しています。そのため、ログイン制御が成功すると、www.example.com ではなく www.example.com:8080 に自動的にリダイレクトされます。では、この問題の解決を手伝ってくれる人はいますか?

編集 私は、春を使用したFacebookでのソーシャルログインの以下の例に従っています https://github.com/spring-projects/spring-social-samples/tree/master/spring-social-showcase-boot コードに従う

スプリング ブート バージョン: 1.2.4

htmlフォームに従う

<form name="fb_signin" id="fb_signin" th:action="@{/signin/facebook}" method="POST">
    <input type="hidden" name="_csrf" th:value="${_csrf.token}"></input>
    <input type="hidden" name="scope" value="publish_stream,user_photos,offline_access"></input>
    <button type="submit"><img th:src="@{/social/facebook/sign-in-with-facebook.png}"></img></button>
</form>

コントローラーをフォローする

@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();
    }
}
4

0 に答える 0