Raj*_*Raj 6 google-openid spring-social jhipster
使用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
在安装yarn,yarn start和.mvnw(spring-boot:run)之后,可以在http:// localhost:8080和http:// localhost:9000上运行该应用程序
从http:// localhost:8080访问应用程序时,从http:// localhost:9000访问应用程序时,使用Google登录可以正常工作,社交登录页面显示 Cannot POST / signin / google,浏览器的网址更改为http:/ / localhost:9000 / signin / google
默认情况下,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 凭证中,您应该添加重定向网址:http://localhost:9060/signin/google