JHipster社交登录Google身份验证错误无法发布/登录/谷歌

时间:2017-11-24 05:06:43

标签: jhipster spring-social google-openid

https://start.jhipster.tech/#/generate-application创建了一个带有JWT和启用社交登录的应用程序,从Google生成了clientID,clientSecret并更新了application.yml。

在Google控制台的Web应用程序客户端ID中, 授权的JavaScript来源  被指定为 http://localhost:8080 和  http://localhost:9000

" 授权重定向URI "设置为http://localhost:8080/signin/googlehttp://localhost:9000/signin/google

纱线安装纱线启动 .mvnw (spring-boot:run)之后,应用程序可以在{{3 }和http://localhost:8080

http://localhost:9000访问应用程序时,使用google登录正常工作,  当从http://localhost:8080访问时,社交登录页面会显示 无法发布/登录/ google ,浏览器的网址会更改为 http://localhost:9000

1 个答案:

答案 0 :(得分:1)

默认情况下,spring social的url未定义到jhipster webpack配置中。

您应该修改文件 webpack / webpack.dev.js ,将 / signin 路径添加到开发服务器配置中,如下所示:

devServer: { contentBase: './target/www', proxy: [{ context: [ /* jhipster-needle-add-entity-to-webpack - JHipster will add entity api paths here */ '/api', '/management', '/swagger-resources', '/v2/api-docs', '/h2-console', '/auth', '/signin' ], target: 'http://127.0.0.1:8080', secure: false }], watchOptions: { ignored: /node_modules/ } }

google api credentials中,您应该添加重定向网址:http://localhost:9060/signin/google