从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/google和http://localhost:9000/signin/google
在纱线安装,纱线启动和 .mvnw (spring-boot:run)之后,应用程序可以在{{3 }和http://localhost:8080
从http://localhost:9000访问应用程序时,使用google登录正常工作, 当从http://localhost:8080访问时,社交登录页面会显示 无法发布/登录/ google ,浏览器的网址会更改为 http://localhost:9000
答案 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