aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/login.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-06-12 15:04:18 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-06-12 15:04:18 +0200
commita831d6f9cd55e33061e748b29cf256ba84ece20d (patch)
tree35443bf8a5006c6d8498bcd9bad6cb280107eac9 /lib/csapi/login.h
parent7d4b46e6daf656a1e97426cb1f2f8c99c68c4dda (diff)
parent9e594bd1d49dc0e1fdb8b74cef11fe3bfa3fdc1e (diff)
downloadlibquotient-a831d6f9cd55e33061e748b29cf256ba84ece20d.tar.gz
libquotient-a831d6f9cd55e33061e748b29cf256ba84ece20d.zip
Merge branch 'kitsune/more-gtad-fixes' into dev
Diffstat (limited to 'lib/csapi/login.h')
-rw-r--r--lib/csapi/login.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/lib/csapi/login.h b/lib/csapi/login.h
index ce6951eb..b9f14266 100644
--- a/lib/csapi/login.h
+++ b/lib/csapi/login.h
@@ -111,12 +111,16 @@ public:
* \param initialDeviceDisplayName
* A display name to assign to the newly-created device. Ignored
* if `device_id` corresponds to a known device.
+ *
+ * \param refreshToken
+ * If true, the client supports refresh tokens.
*/
explicit LoginJob(const QString& type,
const Omittable<UserIdentifier>& identifier = none,
const QString& password = {}, const QString& token = {},
const QString& deviceId = {},
- const QString& initialDeviceDisplayName = {});
+ const QString& initialDeviceDisplayName = {},
+ Omittable<bool> refreshToken = none);
// Result properties
@@ -130,15 +134,23 @@ public:
return loadFromJson<QString>("access_token"_ls);
}
- /// The server_name of the homeserver on which the account has
- /// been registered.
- ///
- /// **Deprecated**. Clients should extract the server_name from
- /// `user_id` (by splitting at the first colon) if they require
- /// it. Note also that `homeserver` is not spelt this way.
- QString homeServer() const
+ /// A refresh token for the account. This token can be used to
+ /// obtain a new access token when it expires by calling the
+ /// `/refresh` endpoint.
+ QString refreshToken() const
+ {
+ return loadFromJson<QString>("refresh_token"_ls);
+ }
+
+ /// The lifetime of the access token, in milliseconds. Once
+ /// the access token has expired a new access token can be
+ /// obtained by using the provided refresh token. If no
+ /// refresh token is provided, the client will need to re-log in
+ /// to obtain a new access token. If not given, the client can
+ /// assume that the access token will not expire.
+ Omittable<int> expiresInMs() const
{
- return loadFromJson<QString>("home_server"_ls);
+ return loadFromJson<Omittable<int>>("expires_in_ms"_ls);
}
/// ID of the logged-in device. Will be the same as the