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

bug:Line登录的错误 #122

Closed
SwordInWind opened this issue Jun 7, 2021 · 2 comments
Closed

bug:Line登录的错误 #122

SwordInWind opened this issue Jun 7, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@SwordInWind
Copy link

问题描述

使用默认的LineRequest在获取AccessToken出现问题.原因为Line的获取接口的参数不是使用查询参数而是表单参数.详情请看https://developers.line.biz/en/reference/line-login/#oauth

环境

  • JustAuth 1.16.1

复现方法

正常使用就会复现

解决方案

将LineRequest的getAccessToken改写.

    protected AuthToken getAccessToken(AuthCallback authCallback) {
        Map params = new HashMap<>();
        params.put("grant_type", "authorization_code");
        params.put("code", authCallback.getCode());
        params.put("redirect_uri", config.getRedirectUri());
        params.put("client_id", config.getClientId());
        params.put("client_secret", config.getClientSecret());
        String response = new HttpUtils(config.getHttpConfig()).post(source.accessToken(), params, false);
        JSONObject accessTokenObject = JSONObject.parseObject(response);
        return AuthToken.builder()
                .accessToken(accessTokenObject.getString("access_token"))
                .refreshToken(accessTokenObject.getString("refresh_token"))
                .expireIn(accessTokenObject.getIntValue("expires_in"))
                .idToken(accessTokenObject.getString("id_token"))
                .scope(accessTokenObject.getString("scope"))
                .tokenType(accessTokenObject.getString("token_type"))
                .build();
    }
@SwordInWind SwordInWind added the bug Something isn't working label Jun 7, 2021
@zhangyd-c zhangyd-c self-assigned this Aug 15, 2021
@zhangyd-c
Copy link
Member

谢谢,1.16.3 版本稍后发布

@zhangyd-c
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants