Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第三方回调的时候,是不是可以增加以下不需要state的一种需求,现在AuthChecker.checkState(authCallback.getState(), source, authStateCache);这一步卡的死死的,建议增加一个判断state值是否存在在请求该方法 #83

Closed
HaiTao-G opened this issue May 29, 2020 · 6 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@HaiTao-G
Copy link

No description provided.

@zhangyd-c
Copy link
Member

state如果不传,默认会生成一个uuid
image
因此应该不会出现你说的这种情况啊, 方便详细描述一下吗

@yourke
Copy link

yourke commented Jun 12, 2020

state如果不传,默认会生成一个uuid
image
因此应该不会出现你说的这种情况啊, 方便详细描述一下吗

他可能说的是默认的login方法,里面校验了的state值,会判断缓存。
image
我也遇到这个问题了,不过我把这个方法重写了,去掉了这个校验。
建议可以加个重载方法之类的。

@HaiTao-G
Copy link
Author

正是二楼说的这样,请求默认的login方法的时候校验的state值.因为我的这边获取微信登录二维码的时候是前端直接请求微信接口获取二维码的,state值是前台赋值并校验的,我这边只需要通过前台给我的code值解析用户信息就行了,但是请求这个默认的登录后台没有state的缓存值,一直报错.
`@Override
public AuthResponse login(AuthCallback authCallback) {
try {
AuthChecker.checkCode(source, authCallback);
AuthChecker.checkState(authCallback.getState(), source, authStateCache);

        AuthToken authToken = this.getAccessToken(authCallback);
        AuthUser user = this.getUserInfo(authToken);
        return AuthResponse.builder().code(AuthResponseStatus.SUCCESS.getCode()).data(user).build();
    } catch (Exception e) {
        Log.error("Failed to login with oauth authorization.", e);
        return this.responseError(e);
    }
}`

@zhangyd-c
Copy link
Member

新版已发布,参考:https://github.com/justauth/JustAuth/releases/tag/1.15.6
image

@zhangyd-c
Copy link
Member

现在maven仓库中可能还没同步,1~2小时后应该就同步过来了

@zhangyd-c zhangyd-c added the good first issue Good for newcomers label Jul 5, 2020
@zhangyd-c zhangyd-c self-assigned this Jul 5, 2020
@liu-yanbo
Copy link

生产环境(阿里云主机)出现这个问题,但是测试环境没有(本地私有云),不知怎么排查。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants