paascloud/paascloud-master

关于本项目oauth2登录设计的安全问题

CVBear opened this issue · 1 comments

本项目使用了oauth2的密码模式但是我发现clietId和clienSecret放在了前端[paascloud-mall-web]的js如下的代码当中这样做是不安全的个人认为应该又后端去使用这种敏感信息,不然oauth2就没有意义了,请码主更新或者解释一下这个设计,谢谢。

username: 'paascloud-client-uac',
password: 'paascloudClientSecret'

paascloud-mall-web/src/api/index.js
import axios from 'axios'; import store from '../store/'; const REFRESH_TOKEN_URL = '/uac/auth/user/refreshToken'; export function refreshToken () { return axios({ method: 'GET', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, url: REFRESH_TOKEN_URL, auth: { username: 'paascloud-client-uac', password: 'paascloudClientSecret' }, params: { refreshToken: store.getters.getRefreshToken, accessToken: store.getters.getAccessToken } }); }

之前我一直也考虑过这种问题,其实这个clietId和clienSecret肯定不能放前端,clietId暴露出来应该没啥问题,微信的oauth2.0授权也可以看到appid