作者 tangxvhui

修复一些问题

... ... @@ -155,16 +155,16 @@ func (srv *AuthService) Authorize(param *command.AuthorizeCommand) (map[string]i
func (srv *AuthService) AccessToken(param *command.AccessTokenCommand) (map[string]interface{}, error) {
userAuth := domain.UserAuth{}
_, err := userAuth.ParseAccessToken(param.AuthCode)
newUseAuth, err := userAuth.ParseAccessToken(param.AuthCode)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "authcode 失效")
}
accessToken, err := userAuth.CreateAccessToken()
accessToken, err := newUseAuth.CreateAccessToken()
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "生成 accessToken 失败")
}
refreshToken, err := userAuth.CreateRefreshToken()
refreshToken, err := newUseAuth.CreateRefreshToken()
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "生成 refreshToken 解析失败")
}
... ... @@ -179,15 +179,15 @@ func (srv *AuthService) AccessToken(param *command.AccessTokenCommand) (map[stri
// 刷新token
func (srv *AuthService) RefreshToken(param *command.RefreshTokenCommand) (map[string]interface{}, error) {
userAuth := domain.UserAuth{}
_, err := userAuth.ParseAccessToken(param.RefreshToken)
newUseAuth, err := userAuth.ParseAccessToken(param.RefreshToken)
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "refresh_token 失效")
}
accessToken, err := userAuth.CreateAccessToken()
accessToken, err := newUseAuth.CreateAccessToken()
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "生成 accessToken 失败")
}
refreshToken, err := userAuth.CreateRefreshToken()
refreshToken, err := newUseAuth.CreateRefreshToken()
if err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "生成 refreshToken 解析失败")
}
... ...