Fix login with custom protocol

This commit is contained in:
Pieter Vander Vennet 2025-01-21 21:07:25 +01:00
parent 93aa4dd280
commit 891edcc0a3
2 changed files with 9 additions and 2 deletions

View file

@ -35,6 +35,13 @@
<data android:host="app.mapcomplete.org" />
<data android:path="/passthrough.html" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="orgmapcomplete" />
<data android:path="/passthrough.html" />
</intent-filter>
</activity>
<provider

View file

@ -87,7 +87,8 @@ public class MainActivity extends BridgeActivity {
return;
}
if (Objects.equals(url.getPath(), "/passthrough.html")) {
System.out.println("urlPath: " + url.getPath()+";"+ String.join(", ",url.getQueryParameterNames()));
if (url.getQueryParameterNames().contains("oauth_token")) {
var token = url.getQueryParameter("oauth_token");
JSObject obj = new JSObject();
obj.put("oauth_token", token);
@ -98,7 +99,6 @@ public class MainActivity extends BridgeActivity {
if (this.authRequest != null) {
this.authRequest.resolve(res);
}
return;
}
System.out.println("Intercepted URL: " + url);