![](/img/trans.png)
[英]sonarqube updatecenter error We're sorry, but something went wrong
[英]Spring social facebook login - sorry, something went wrong
我正在嘗試使用org.springframework.boot:spring-boot-starter-social-facebook
在我的spring webapp中實現facebook登錄org.springframework.boot:spring-boot-starter-social-facebook
,但每次我按照登錄流程我都會在facebook主機上看到這個頁面:
這是我的設置:
application.properties
spring.social.facebook.appId=xxx
spring.social.facebook.appSecret=xxx
在Facebook開發者頁面中,我啟用了facebook登錄產品,並添加了http://localhost:8080/connect/facebook
作為我的重定向uri。
寫了一個登錄表:
連接/ facebook.html
<form th:action="@{/connect/facebook}" method="POST">
<input type="hidden" name="scope" value="user_posts"/>
<button type="submit">Connect to Facebook</button>
</form>
這會將我重定向到此網址: https://www.facebook.com/v2.3/dialog/oauth?client_id=xxx&response_type=code&_csrf=732c940f-37fc-406b-b08b-d591e0e372a3&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fconnect%2Ffacebook&scope=user_posts&state=8ec3aaa3-972e-401e-b47f-930f654f6fd8
: https://www.facebook.com/v2.3/dialog/oauth?client_id=xxx&response_type=code&_csrf=732c940f-37fc-406b-b08b-d591e0e372a3&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fconnect%2Ffacebook&scope=user_posts&state=8ec3aaa3-972e-401e-b47f-930f654f6fd8
client_id https://www.facebook.com/v2.3/dialog/oauth?client_id=xxx&response_type=code&_csrf=732c940f-37fc-406b-b08b-d591e0e372a3&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fconnect%2Ffacebook&scope=user_posts&state=8ec3aaa3-972e-401e-b47f-930f654f6fd8
xxx https://www.facebook.com/v2.3/dialog/oauth?client_id=xxx&response_type=code&_csrf=732c940f-37fc-406b-b08b-d591e0e372a3&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fconnect%2Ffacebook&scope=user_posts&state=8ec3aaa3-972e-401e-b47f-930f654f6fd8
response_type https://www.facebook.com/v2.3/dialog/oauth?client_id=xxx&response_type=code&_csrf=732c940f-37fc-406b-b08b-d591e0e372a3&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fconnect%2Ffacebook&scope=user_posts&state=8ec3aaa3-972e-401e-b47f-930f654f6fd8
code https://www.facebook.com/v2.3/dialog/oauth?client_id=xxx&response_type=code&_csrf=732c940f-37fc-406b-b08b-d591e0e372a3&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fconnect%2Ffacebook&scope=user_posts&state=8ec3aaa3-972e-401e-b47f-930f654f6fd8
_csrf https://www.facebook.com/v2.3/dialog/oauth?client_id=xxx&response_type=code&_csrf=732c940f-37fc-406b-b08b-d591e0e372a3&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fconnect%2Ffacebook&scope=user_posts&state=8ec3aaa3-972e-401e-b47f-930f654f6fd8
732c940f-37fc-406b-b08b-d591e0e372a3 https://www.facebook.com/v2.3/dialog/oauth?client_id=xxx&response_type=code&_csrf=732c940f-37fc-406b-b08b-d591e0e372a3&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fconnect%2Ffacebook&scope=user_posts&state=8ec3aaa3-972e-401e-b47f-930f654f6fd8
redirect_uri https://www.facebook.com/v2.3/dialog/oauth?client_id=xxx&response_type=code&_csrf=732c940f-37fc-406b-b08b-d591e0e372a3&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fconnect%2Ffacebook&scope=user_posts&state=8ec3aaa3-972e-401e-b47f-930f654f6fd8
3A%2F%2Flocalhost% https://www.facebook.com/v2.3/dialog/oauth?client_id=xxx&response_type=code&_csrf=732c940f-37fc-406b-b08b-d591e0e372a3&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fconnect%2Ffacebook&scope=user_posts&state=8ec3aaa3-972e-401e-b47f-930f654f6fd8
我認為這里不需要_csrf
來自spring的csrf注入器,但它無論如何都不應該有任何區別。
有誰知道如何解決這個問題? 錯誤消息根本不詳細,我不知道在哪里可以開始故障排除。
在我的案例中,我也遇到過這個問題
1-屬性未正確加載導致Facebook對無效的app-id
和app-secret
表示抱歉。 因此,請確保您的應用ID和密碼正常。
2-在Facebook應用儀表板的重定向URI中只需輸入http://localhost:8080/
然后就可以了。
有關更多幫助和指導,您可以檢查我創建的github項目,因為使用Spring Social時會遇到大多數問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.