Sign-in Error in Android App

Hello :slight_smile:
We are evaluating open edX at the moment. I deployed a tutor instance more or less via quickstart. However, I had to make some modifications. I do NOT generate SSL certificates with tutor and I manually changed the nginx ports to high numbers in the docker-compose script, because there is already a letsencrypt docker thingy running. So, I have one more nginx in the chain doing the SSL termination.

Everything seems to be working. Now I compiled the Android App (debug mode), but I cannot login. I am getting an “Unknown Error” on the device. The nginx log is:

nginx-proxy | xxxxxxxxx 201.184.139.74 - - [08/Feb/2020:19:18:48 +0000] “POST /oauth2/access_token/ HTTP/1.1” 301 169 “-” “Dalvik/2.1.0 (Linux; U; Android 9; ONEPLUS A5000 Build/PKQ1.180716.001) xxxxxxxxxxxxxxxxxx/2.19.1”
nginx-proxy | xxxxxxxxx 201.184.139.74 - - [08/Feb/2020:19:18:48 +0000] “GET /oauth2/access_token/ HTTP/2.0” 400 80 “-” “Dalvik/2.1.0 (Linux; U; Android 9; ONEPLUS A5000 Build/PKQ1.180716.001) xxxxxxxxxxxxxxxxxxxx/2.19.1”

Is that supposed to work out of the box? Maybe an issue with my reverse proxy setup? Where can I start looking?

Hi @mindrunner!

Yes, the Android app is supposed to run out of the box (although I must confess I did not test it recently).
In my experience, 400 errors are caused by incorrect ALLOWED_HOSTS django setting. This might occur if you are not correctly overriding the X-Forwarded-For header in your proxy.

May I suggest you do not create a custom additional proxy, but instead use the proxy config files that come bundled with tutor? Your use case is covered in the docs: https://docs.tutor.overhang.io/local.html#running-open-edx-behind-a-web-proxy

Hello @regis
Thank you for the answer. Thing is, I am trying to install tutor on a box with only one IP and an already existing setup of several applications. I merged my SSL config with the generated one. However, I think that those proxy headers are set anyways by default. Anything else I need to be aware of? How can I further debug this?

This is my nginx config for ed-x
https://pastebin.com/UwHW7uqg

I can add some information. The Android App is making a GET request to /oauth2/access_token. If I do that with the Browser, I get:
{“error_description”: “Only POST requests allowed.”, “error”: “invalid_request”}

I think, the App should make a POST request and this is not a configuration issue on my side. I am new to Open edX though and still a bit lost. Is the app part of tutor or of open edX. Where can I find the sources?

Hmmm I think I understand what is going on. Let me try to answer your question first:

I am new to Open edX though and still a bit lost. Is the app part of tutor or of open edX. Where can I find the sources?

The Android app is mainly developed by edX and is compatible with all Open edX platforms: GitHub - openedx/edx-app-android: The Open edX mobile app for Android!
Tutor just makes it easy to build the Android app (from inside a docker container) and distribute it to learners.

I had forgotten that Tutor builds the Android app from the master branch of the github repo: https://github.com/overhangio/tutor/blob/master/tutor/templates/build/android/Dockerfile#L26
This was an error. Instead, what we should have done is to clone a specific git tag from the repository. What probably happened is that someone pushed a change to the master branch which is no longer compatible with the Ironwood release.

I created an issue to keep track of this problem: 400 error during sign in on Android app · Issue #289 · overhangio/tutor · GitHub

Thanks for your thorough investigations, I appreciate it.

Awesome, thanks. Following up on this in github!

Cheers

Hi I generated an apk from a Koa instance on my macOS BigSur machine. I have connection error when I register/sign-in through an Android emulator (apkonline). I tried other apk (not tutor) and it is OK. Would this be related to the error above…but instead of Ironwood…its Koa? Thanks