Android App auth using browser setup

I was trying to setup the auth using browser setup in the android app with this PR.

I got to see this documentation to setup the OAuth application in the Django toolkit here and as said, I have created the application with the redirect uri and added grant type as Authorization code.
From the android app, I got to the browser screen to login and once logged in even though I got to the app screen, it showed an error. The log shows this {"error_code":"non_supported_token","developer_message":"Only access tokens with grant type password are supported."}

Is there anything I am missing? Thanks in advance!

cc @xitij2000

Hi @zameel7,

The reason for that error is that the mobile app tries to exchange the auth token for a cookie/session login so that it can interact with some views that need that login session. However, the auth exchange API only supports tokens generates from an password-based OAuth client while the one in the Android app is auth code based.

We’ve fixed this issue in this PR, which you might need to backport to your release.

1 Like

Is this PR added to the latest Redwood release?

No, it is not.

I have backported the PR, but I have issue getting results of the APIs. The list of enrolled course etc. are not being shown.

Could you share more details?

Steps I have taken:

  • Created a new oauth application with grant type authorization code
  • Used the client id in the mobile application
  • Backported the PR to my release
  • Built the mobile application using the latest changes

Login process was done and was redirected back to the mobile application. The discover section shows no course even though I have many courses

Have you marked the courses as available on mobile using the ‘Mobile Course Available’ setting in advanced settings?

2 Likes

Oopsie, my bad :smile:…!
Got it fixed.

@xitij2000 , was the issue of not getting logout fixed?

No, we concluded it was a non-issue for us.

@xitij2000, I was trying to backport the changes in to the redwood.3 in android app. Facing some troubles there. Will it be possible if I try?

@zameel7 I’m not sure what you’re asking here? If it’s possible to backport to an older version of the app?

We did work on this on an older version of the app, you can see the PR here: feat: Add support for browser-based logins by xitij2000 · Pull Request #45 · openedx/openedx-app-android · GitHub