From 6d0a1ee824b929168e24c5b54d1bd810d6de8827 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 15 Jul 2020 20:20:52 +0200 Subject: [PATCH] SSO Login: use "element://element" url instead of "riotx://riotx" --- docs/signin.md | 8 ++++---- vector/src/main/AndroidManifest.xml | 4 ++-- .../java/im/vector/riotx/features/login/LoginViewState.kt | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/signin.md b/docs/signin.md index 7d3a4f819b..12fb37499c 100644 --- a/docs/signin.md +++ b/docs/signin.md @@ -155,9 +155,9 @@ Not supported yet in RiotX In this case, the user can click on "Sign in with SSO" and the native web browser, or a ChromeCustomTab if the device supports it, will be launched on the page -> https://homeserver.with.sso/_matrix/client/r0/login/sso/redirect?redirectUrl=riotx%3A%2F%2Friotx +> https://homeserver.with.sso/_matrix/client/r0/login/sso/redirect?redirectUrl=element%3A%2F%element -The parameter `redirectUrl` is set to `riotx://riotx`. +The parameter `redirectUrl` is set to `element://element`. ChromeCustomTabs are an intermediate way to display a WebPage, between a WebView and using the external browser. More info can be found [here](https://developer.chrome.com/multidevice/android/customtabs) @@ -167,9 +167,9 @@ During the process, user may be asked to validate an email by clicking on a link Once the process is finished, the web page will call the `redirectUrl` with an extra parameter `loginToken` -> riotx://riotx?loginToken=MDAxOWxvY2F0aW9uIG1vemlsbGEub3JnCjAwMTNpZGVudGlmaWVy +> element://element?loginToken=MDAxOWxvY2F0aW9uIG1vemlsbGEub3JnCjAwMTNpZGVudGlmaWVy -This navigation is intercepted by RiotX by the `LoginActivity`, which will then ask the homeserver to convert this `loginToken` to an access token +This navigation is intercepted by Element by the `LoginActivity`, which will then ask the homeserver to convert this `loginToken` to an access token > curl -X POST --data $'{"type":"m.login.token","token":"MDAxOWxvY2F0aW9uIG1vemlsbGEub3JnCjAwMTNpZGVudGlmaWVy"}' 'https://homeserver.with.sso/_matrix/client/r0/login' diff --git a/vector/src/main/AndroidManifest.xml b/vector/src/main/AndroidManifest.xml index ef591de1b6..344a10e75b 100644 --- a/vector/src/main/AndroidManifest.xml +++ b/vector/src/main/AndroidManifest.xml @@ -80,8 +80,8 @@ - - + + diff --git a/vector/src/main/java/im/vector/riotx/features/login/LoginViewState.kt b/vector/src/main/java/im/vector/riotx/features/login/LoginViewState.kt index 655966ce25..26e552ed1f 100644 --- a/vector/src/main/java/im/vector/riotx/features/login/LoginViewState.kt +++ b/vector/src/main/java/im/vector/riotx/features/login/LoginViewState.kt @@ -73,7 +73,7 @@ data class LoginViewState( append(homeServerUrl?.trim { it == '/' }) append(SSO_REDIRECT_PATH) // Set a redirect url we will intercept later - appendParamToUrl(SSO_REDIRECT_URL_PARAM, RIOTX_REDIRECT_URL) + appendParamToUrl(SSO_REDIRECT_URL_PARAM, VECTOR_REDIRECT_URL) deviceId?.takeIf { it.isNotBlank() }?.let { // But https://github.com/matrix-org/synapse/issues/5755 appendParamToUrl("device_id", it) @@ -83,6 +83,6 @@ data class LoginViewState( companion object { // Note that the domain can be displayed to the user for confirmation that he trusts it. So use a human readable string - private const val RIOTX_REDIRECT_URL = "riotx://riotx" + private const val VECTOR_REDIRECT_URL = "element://element" } }