Page MenuHomePhabricator

Allow callback URL to be custom app deeplink
Closed, ResolvedPublic

Description

Currently, the extension requires the callback URL to use only the https scheme, and nothing else.
Since we'd like to start adopting OAuth in native apps, we would need the callback URL to be a deeplink into the app, which would be of the form wikipedia://oauth/callback, so the scheme restriction should be expanded to include it.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1166240 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/extensions/OAuth@master] Allow OAuth 2 callback URL to be custom app deeplink

https://gerrit.wikimedia.org/r/1166240

Spent some time testing this patch today, and I think it works as expected.

Test plan

Before

Tried to create (propose) an oauth2 consumer via Special:OAuthConsumerRegistration/propose/oauth2 with a deep link, which failed since the URL scheme doesn't match // or http:// or https://.

Screenshot 2025-07-11 at 4.46.34 PM.png (3,402×2,050 px, 697 KB)

After

I tried the same step mentioned above, but it failed when the consumer was marked as "confidential". Since deeplinks are considered non-confidential, they need to be explicitly stated in the form, and the code enforces these checks.

So I had to uncheck the "Client is confidential" field for this to work, and the consumer was created.

Screenshot 2025-07-11 at 4.48.30 PM.png (3,246×1,946 px, 618 KB)
Screenshot 2025-07-11 at 4.47.17 PM.png (2,940×1,220 px, 309 KB)

Does the test plan sound reasonable @Tgr.

Change #1166240 merged by jenkins-bot:

[mediawiki/extensions/OAuth@master] Allow OAuth 2 callback URL to be custom app deeplink

https://gerrit.wikimedia.org/r/1166240

Does the test plan sound reasonable @Tgr.

Yup, thanks!