From ee23967afec96c555cc6eb3d8b2fd7572e8b0eb8 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Mon, 8 Jun 2020 08:53:06 +0200 Subject: [PATCH] I made a mistake: registration step m.login.token type is not the same that login request. --- docs/signin.md | 10 +++------- .../android/internal/auth/data/TokenLoginParams.kt | 6 +----- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/docs/signin.md b/docs/signin.md index 348e29cbdf..6a52b2d83c 100644 --- a/docs/signin.md +++ b/docs/signin.md @@ -161,7 +161,7 @@ The parameter `redirectUrl` is set to `riotx://riotx`. 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) -The browser will then take care of the SSO login, which may include creating a third party account, entering an email, or any other possibility. +The browser will then take care of the SSO login, which may include creating a third party account, entering an email, settings a display name, or any other possibilities. During the process, user may be asked to validate an email by clicking on a link it contains. The link has to be opened in the browser which initiates the authentication. This is why we cannot use WebView anymore. @@ -171,16 +171,12 @@ Once the process is finished, the web page will call the `redirectUrl` with an e This navigation is intercepted by RiotX by the `LoginActivity`, which will then ask the homeserver to convert this `loginToken` to an access token -RiotX is generating a `txn_id` parameter, to avoid a replay of the request if the loginToken has been leaked. -*Note*: for the moment RiotX does not send any `session` parameter in this request. - -> curl -X POST --data $'{"type":"m.login.token","token":"MDAxOWxvY2F0aW9uIG1vemlsbGEub3JnCjAwMTNpZGVudGlmaWVy","txn_id":"5114076e-40f0-477f-aa50-8ea2442d9dc1"}' 'https://homeserver.with.sso/_matrix/client/r0/login' +> curl -X POST --data $'{"type":"m.login.token","token":"MDAxOWxvY2F0aW9uIG1vemlsbGEub3JnCjAwMTNpZGVudGlmaWVy"}' 'https://homeserver.with.sso/_matrix/client/r0/login' ```json { "type": "m.login.token", - "token": "MDAxOWxvY2F0aW9uIG1vemlsbGEub3JnCjAwMTNpZGVudGlmaWVy", - "txn_id": "5114076e-40f0-477f-aa50-8ea2442d9dc1" + "token": "MDAxOWxvY2F0aW9uIG1vemlsbGEub3JnCjAwMTNpZGVudGlmaWVy" } ``` diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/data/TokenLoginParams.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/data/TokenLoginParams.kt index cf9c6a8e5b..3bd90e36db 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/data/TokenLoginParams.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/auth/data/TokenLoginParams.kt @@ -18,13 +18,9 @@ package im.vector.matrix.android.internal.auth.data import com.squareup.moshi.Json import com.squareup.moshi.JsonClass -import java.util.UUID @JsonClass(generateAdapter = true) internal data class TokenLoginParams( @Json(name = "type") override val type: String = LoginFlowTypes.TOKEN, - @Json(name = "token") val token: String, - // client generated nonce - @Json(name = "txn_id") val txId: String = UUID.randomUUID().toString() - // Param session is not useful in this case? + @Json(name = "token") val token: String ) : LoginParams