Search code examples
androidgithuboauthgithub-api

Why is the GitHub authorization button in the OAuth flow grayed out?


I am building an Android app that signs in users to GitHub using OAuth. I followed the instructions here to do so. As the first part of the process, I sent users to the URL

https://github.com/login/oauth/authorize?scope=repo&client_id=MY_CLIENT_ID

However, when I sign in on my Android device, the Authorize xxxx button appears to be greyed out and I can't click it. Does anyone have a clue why this is? (Large screenshot below)

I think the button may not have been greyed out before, the first time I ran the app and signed in. However, I can't tell for sure because I was in a rush.


Solution

  • So, I pasted the link into Chrome on my computer and the OAuth process worked fine. I noticed the button was greyed out at first, but then became bright green. This got me wondering: was JavaScript enabled by default in the Android WebView? Sure enough, it wasn't. I found this answer which details how to enable JS. This was the key line that got everything working:

    webView.getSettings().setJavaScriptEnabled(true);