diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-06-12 15:04:18 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-06-12 15:04:18 +0200 |
commit | a831d6f9cd55e33061e748b29cf256ba84ece20d (patch) | |
tree | 35443bf8a5006c6d8498bcd9bad6cb280107eac9 /lib/csapi/registration.h | |
parent | 7d4b46e6daf656a1e97426cb1f2f8c99c68c4dda (diff) | |
parent | 9e594bd1d49dc0e1fdb8b74cef11fe3bfa3fdc1e (diff) | |
download | libquotient-a831d6f9cd55e33061e748b29cf256ba84ece20d.tar.gz libquotient-a831d6f9cd55e33061e748b29cf256ba84ece20d.zip |
Merge branch 'kitsune/more-gtad-fixes' into dev
Diffstat (limited to 'lib/csapi/registration.h')
-rw-r--r-- | lib/csapi/registration.h | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/lib/csapi/registration.h b/lib/csapi/registration.h index 39840008..7a20cab8 100644 --- a/lib/csapi/registration.h +++ b/lib/csapi/registration.h @@ -93,6 +93,9 @@ public: * If true, an `access_token` and `device_id` should not be * returned from this call, therefore preventing an automatic * login. Defaults to false. + * + * \param refreshToken + * If true, the client supports refresh tokens. */ explicit RegisterJob(const QString& kind = QStringLiteral("user"), const Omittable<AuthenticationData>& auth = none, @@ -100,7 +103,8 @@ public: const QString& password = {}, const QString& deviceId = {}, const QString& initialDeviceDisplayName = {}, - Omittable<bool> inhibitLogin = none); + Omittable<bool> inhibitLogin = none, + Omittable<bool> refreshToken = none); // Result properties @@ -118,15 +122,27 @@ public: return loadFromJson<QString>("access_token"_ls); } - /// The server_name of the homeserver on which the account has - /// been registered. + /// 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. + /// + /// Omitted if the `inhibit_login` option is false. + 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. /// - /// **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 + /// Omitted if the `inhibit_login` option is false. + Omittable<int> expiresInMs() const { - return loadFromJson<QString>("home_server"_ls); + return loadFromJson<Omittable<int>>("expires_in_ms"_ls); } /// ID of the registered device. Will be the same as the |