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

如果出现登陆失败或者请求失败 #57

Open
CarGuo opened this issue Apr 21, 2020 · 8 comments
Open

如果出现登陆失败或者请求失败 #57

CarGuo opened this issue Apr 21, 2020 · 8 comments

Comments

@CarGuo
Copy link
Owner

CarGuo commented Apr 21, 2020

1、确定你申请的 ClientId 和 ClientSecret 是正确的。

2、确定正常使用用户名密码登陆或者 OAuth 登陆。

3、Connection refused 的情况请更换网络环境。

The message 'Connection Refused' has two main causes:

  • Nothing is listening on the IP:Port you are trying to connect to.

  • The port is blocked by a firewall.

Http 请求 422 请检查申请的 ClientId、 ClientSecret,登陆用用户名和密码,不用使用邮箱;授权登记方式记得 readme 中的 Authorization callback URL 一栏必须填入 gsygithubapp://authed

Connection Refused 问题是Github Api 和我们天朝网络的兼容问题,建议稍后再试或者换个网络环境(wifi、4G、电信/移动/联通)

@CarGuo CarGuo pinned this issue Apr 21, 2020
@madreain
Copy link

@serge66
Copy link

serge66 commented Jul 21, 2020

你好,按要求配置了:Clientid和CLIENT_SECRET,确认了正确。
Authorization callback URL 也已经配置

build apk安装后 输入 github 用户名密码登录提示 如下:
net::ERR_UNKNOWN_URL_SCHEME

image

烦请大佬指导下,谢谢!

@CarGuo
Copy link
Owner Author

CarGuo commented Jul 21, 2020

webview授权登录不行???你可以调试是不是webview里面在shouldreload的判断没有进入if的判断?

@xinghuogit
Copy link

xinghuogit commented Oct 20, 2020

override fun shouldOverrideUrlLoading(view: WebView?, request: String?) : Boolean(Android7.0废弃)
override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean
测试手机在Android7.0以下,需要加上废弃方法。
例子如下:

val webViewClient: WebViewClient = object : WebViewClient() {

        override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
        }

        override fun onPageFinished(view: WebView?, url: String?) {
            oauth_webview_loadingBar.visibility = View.GONE
        }

        override fun shouldOverrideUrlLoading(view: WebView?, request: String?): Boolean {
            if (request != null &&
                    request.startsWith("gsygithubapp://authed")) {//request = gsygithubapp://authed?code=85f8e462baeef71ae6875&state=app
                val codeIndexLast = request.indexOf("code=") + 5
                val codeIndexFirst = request.indexOf("&state")
                val code = request.subSequence(codeIndexLast, codeIndexFirst)
                Log.i("web codeIndexLast", "${codeIndexLast.toString()}  ${codeIndexFirst.toString()}   ${code.toString()} ")
                loginViewModel.oauth(context!!, code.toString())
                return true
            }
            return false
        }

        override fun shouldOverrideUrlLoading(view: WebView?, request: WebResourceRequest?): Boolean {
            if (request != null && request.url != null &&
                    request.url.toString().startsWith("gsygithubapp://authed")) {
                val code = request.url.getQueryParameter("code")
                loginViewModel.oauth(context!!, code);
                return true
            }
            return false
        }
    }

@msrlin
Copy link

msrlin commented Dec 29, 2020

按钮点击授权后,无法登录

具体现象为 授权按钮(Authorize XXX)那边是灰色的enable状态

底部有3个TIP
1.Not owned operated by Github
2.Created less than a day ago
3.Fewer than 10GitHub users

github账号很早就建了,创建CLIENT_ID、CLIENT_SECRET 是今天刚创建的。

@CarGuo
Copy link
Owner Author

CarGuo commented Dec 29, 2020

CarGuo/gsy_github_app_flutter#643 (comment) 已经记录 @msrlin 参考下另外一个项目

@msrlin
Copy link

msrlin commented Dec 30, 2020

CarGuo/gsy_github_app_flutter#643 (comment) 已经记录 @msrlin 参考下另外一个项目

OK ,照着说明解决了

@starplatinum3
Copy link

https://acc15t4bm5.feishu.cn/docx/doxcnpGz1yuAkaDqQ7b7sHBsiue

rrorStr: subscribe: {"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/issues#create-an-issue"}
2022-06-29 22:08:14.587 2089-2315/com.shuyu.github.kotlin I/errorCode: subscribe: 404
2022-06-29 22:08:14.615 2089-2089/com.shuyu.github.kotlin I/InputTransport: Destroy ARC handle: 0xbf158370
2022-06-29 22:08:14.616 2089-2089/com.shuyu.github.kotlin W/System.err: java.lang.Throwable: 404
2022-06-29 22:08:14.616 2089-2089/com.shuyu.github.kotlin W/System.err: at com.shuyu.github.kotlin.common.net.FlatMapResponse2ResponseObject.subscribe(FlatMapUtils.kt:62)
2022-06-29 22:08:14.617 2089-2089/com.shuyu.github.kotlin W/System.err: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.subscribeInner(ObservableFlatMap.java:165)
2022-06-29 22:08:14.617 2089-2089/com.shuyu.github.kotlin W/System.err: at io.reactivex.internal.operators.observable.ObservableFlatMap$MergeObserver.onNext(ObservableFlatMap.java:139)
2022-06-29 22:08:14.617 2089-2089/com.shuyu.github.kotlin W/System.err: at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:47)
2022-06-29 22:08:14.617 2089-2089/com.shuyu.github.kotlin W/System.err: at io.reactivex.Observable.subscribe(Observable.java:12267)
2022-06-29 22:08:14.617 2089-2089/com.shuyu.github.kotlin W/System.err: at io.reactivex.internal.operators.observable.ObservableFlatMap.subscribeActual(ObservableFlatMap.java:55)
2022-06-29 22:08:14.617 2089-2089/com.shuyu.github.kotlin W/System.err: at io.reactivex.Observable.subscribe(Observable.java:12267)
2022-06-29 22:08:14.617 2089-2089/com.shuyu.github.kotlin W/System.err: at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
2022-06-29 22:08:14.618 2089-2089/com.shuyu.github.kotlin W/System.err: at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:578)
2022-06-29 22:08:14.618 2089-2089/com.shuyu.github.kotlin W/System.err: at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
2022-06-29 22:08:14.618 2089-2089/com.shuyu.github.kotlin W/System.err: at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
2022-06-29 22:08:14.618 2089-2089/com.shuyu.github.kotlin W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2022-06-29 22:08:14.618 2089-2089/com.shuyu.github.kotlin W/System.err: at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
2022-06-29 22:08:14.618 2089-2089/com.shuyu.github.kotlin W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2022-06-29 22:08:14.618 2089-2089/com.shuyu.github.kotlin W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2022-06-29 22:08:14.618 2089-2089/com.shuyu.github.kotlin W/System.err: at java.lang.Thread.run(Thread.java:923)
2022-06-29 22:08:14.619 2089-2089/com.shuyu.github.kotlin W/System.err: Caused by: java.lang.Throwable: {"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/issues#create-an-issue"}
2022-06-29 22:08:14.619 2089-2089/com.shuyu.github.kotlin W/System.err: ... 16 more
2022-06-29 22:08:14.619 2089-2089/com.shuyu.github.kotlin I/创建issue 出错: onFailure:
docs.github.com

@POST("repos/{owner}/{repo}/issues")
@Headers("Accept: application/vnd.github.html,application/vnd.github.VERSION.raw")
fun createIssue(
        @Path("owner") owner: String,
        @Path("repo") repo: String,
        @Body body: Issue
): Observable<Response<Issue>>
fun createIssue(context: Context, userName: String, reposName: String, issue: Issue, resultCallBack: ResultCallBack<IssueUIModel>?) {
    Log.i("createIssue", "createIssue: 开始")
    Log.i("userName", "createIssue: "+userName)
    Log.i("reposName", "createIssue: "+reposName)
    Log.i("issue", "createIssue: "+issue)
    val issueService = retrofit.create(IssueService::class.java).createIssue(userName, reposName, issue)
            .flatMap {
                FlatMapResponse2ResponseObject(it, object : FlatConversionObjectInterface<Issue, IssueUIModel> {
                    override fun onConversion(t: Issue?): IssueUIModel {
                        return IssueConversion.issueToIssueUIModel(t!!)
                    }
                })
            }
    RetrofitFactory.executeResult(issueService, object : ResultProgressObserver<IssueUIModel>(context) {

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

No branches or pull requests

6 participants