justauth / JustAuth

🏆Gitee 最有价值开源项目 🚀:100: 小而全而美的第三方登录开源组件。目前已支持Github、Gitee、微博、钉钉、百度、Coding、腾讯云开发者平台、OSChina、支付宝、QQ、微信、淘宝、Google、Facebook、抖音、领英、小米、微软、今日头条、Teambition、StackOverflow、Pinterest、人人、华为、企业微信、酷家乐、Gitlab、美团、饿了么、推特、飞书、京东、阿里云、喜马拉雅、Amazon、Slack和 Line 等第三方平台的授权登录。 Login, so easy!
https://www.justauth.cn
MIT License
16.57k stars 2.78k forks source link

bug: Twitter无法登录 报错restricted header name: "host" #174

Closed xiao-wu-makes-herbal-tea closed 1 year ago

xiao-wu-makes-herbal-tea commented 1 year ago
        case "google":
            authRequest = new AuthGoogleRequest(AuthConfig.builder()
                    .clientId("861445321239-97gn0s07f .googleusercontent.com")
                    .clientSecret("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")
                    .redirectUri("http://localhost:8443/oauth/callback/google")
                    .scopes(AuthScopeUtils.getScopes(AuthGoogleScope.USER_EMAIL, AuthGoogleScope.USER_PROFILE, AuthGoogleScope.USER_OPENID))
                    // 针对国外平台配置代理
                    .httpConfig(HttpConfig.builder()
                            .timeout(15000)
                            .proxy(new Proxy(Proxy.Type.HTTP, new InetSocketAddress("127.0.0.1", 10080)))
                            .build())
                    .build());

Issue description

java.lang.IllegalArgumentException: restricted header name: "Host" at java.net.http/jdk.internal.net.http.common.Utils.newIAE(Utils.java:286) at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.checkNameAndValue(HttpRequestBuilderImpl.java:110) at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.header(HttpRequestBuilderImpl.java:126) at java.net.http/jdk.internal.net.http.HttpRequestBuilderImpl.header(HttpRequestBuilderImpl.java:43) at com.xkcoding.http.util.MapUtil.forEach(MapUtil.java:77)

zhangyd-c commented 1 year ago

已修复,预计在 1.6.6 版本发布,请关注