使用JWT和启用社交登录从https://start.jhipster.tech/#/generate-application创建了一个应用程序,从Google生成了clientID,clientSecret并更新了application.yml。
在Google控制台的Web应用程序客户端ID中,授权的JavaScript来源被指定为http://localhost:8080和http://localhost:9000
“授权重定向URI”设置为http://localhost:8080/signin/google和http://localhost:9000/signin/google
纱线安装,纱线启动和.mvnw(弹簧启动:运行)后,应用程序可以在http://localhost:8080和http://localhost:9000运行
当从http://localhost:8080访问应用程序时,使用google登录工作正常,当从http://localhost:9000访问时,社交登录页面显示无法POST / signin / google和浏览器的url更改为http://localhost:9000/signin/google
默认情况下,spring social的url未定义到jhipster webpack配置中。
您应该修改文件webpack / webpack.dev.js以将/ signin路径添加到dev服务器配置,如下所示:
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