diff --git a/back/src/Kyoo.Abstractions/Models/Resources/JwtToken.cs b/back/src/Kyoo.Abstractions/Models/Resources/JwtToken.cs
new file mode 100644
index 00000000..aa0c5e45
--- /dev/null
+++ b/back/src/Kyoo.Abstractions/Models/Resources/JwtToken.cs
@@ -0,0 +1,71 @@
+// Kyoo - A portable and vast media library solution.
+// Copyright (c) Kyoo.
+//
+// See AUTHORS.md and LICENSE file in the project root for full license information.
+//
+// Kyoo is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// any later version.
+//
+// Kyoo is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Kyoo. If not, see .
+
+using System;
+using System.Text.Json.Serialization;
+using Newtonsoft.Json;
+
+namespace Kyoo.Abstractions.Models;
+
+///
+/// A container representing the response of a login or token refresh.
+///
+///
+/// Initializes a new instance of the class.
+///
+/// The access token used to authorize requests.
+/// The refresh token to retrieve a new access token.
+/// When the access token will expire.
+public class JwtToken(string accessToken, string refreshToken, TimeSpan expireIn)
+{
+ ///
+ /// The type of this token (always a Bearer).
+ ///
+ [JsonProperty("token_type")]
+ [JsonPropertyName("token_type")]
+ public string TokenType => "Bearer";
+
+ ///
+ /// The access token used to authorize requests.
+ ///
+ [JsonProperty("access_token")]
+ [JsonPropertyName("access_token")]
+ public string AccessToken { get; set; } = accessToken;
+
+ ///
+ /// The refresh token used to retrieve a new access/refresh token when the access token has expired.
+ ///
+ [JsonProperty("refresh_token")]
+ [JsonPropertyName("refresh_token")]
+ public string RefreshToken { get; set; } = refreshToken;
+
+ ///
+ /// When the access token will expire. After this time, the refresh token should be used to retrieve.
+ /// a new token.cs
+ ///
+ [JsonProperty("expire_in")]
+ [JsonPropertyName("expire_in")]
+ public TimeSpan ExpireIn { get; set; } = expireIn;
+
+ ///
+ /// The exact date at which the access token will expire.
+ ///
+ [JsonProperty("expire_at")]
+ [JsonPropertyName("expire_at")]
+ public DateTime ExpireAt { get; set; } = DateTime.UtcNow + expireIn;
+}
diff --git a/back/src/Kyoo.Abstractions/Models/Resources/User.cs b/back/src/Kyoo.Abstractions/Models/Resources/User.cs
index 6ad3d7db..4c0a6a09 100644
--- a/back/src/Kyoo.Abstractions/Models/Resources/User.cs
+++ b/back/src/Kyoo.Abstractions/Models/Resources/User.cs
@@ -69,6 +69,11 @@ namespace Kyoo.Abstractions.Models
///
public Dictionary Settings { get; set; } = new();
+ ///
+ /// User accounts on other services.
+ ///
+ public Dictionary ExternalId { get; set; } = new();
+
public User() { }
[JsonConstructor]
@@ -81,4 +86,23 @@ namespace Kyoo.Abstractions.Models
}
}
}
+
+ public class ExternalToken
+ {
+ ///
+ /// The id of this user on the external service.
+ ///
+ public string Id { get; set; }
+
+ ///
+ /// A jwt token used to interact with the service.
+ /// Do not forget to refresh it when using it if necessary.
+ ///
+ public JwtToken Token { get; set; }
+
+ ///
+ /// The link to the user profile on this website. Null if it does not exist.
+ ///
+ public string? ProfileUrl { get; set; }
+ }
}
diff --git a/back/src/Kyoo.Authentication/Models/JwtToken.cs b/back/src/Kyoo.Authentication/Models/JwtToken.cs
deleted file mode 100644
index c866353a..00000000
--- a/back/src/Kyoo.Authentication/Models/JwtToken.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-// Kyoo - A portable and vast media library solution.
-// Copyright (c) Kyoo.
-//
-// See AUTHORS.md and LICENSE file in the project root for full license information.
-//
-// Kyoo is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// any later version.
-//
-// Kyoo is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Kyoo. If not, see .
-
-using System;
-using System.Text.Json.Serialization;
-using Newtonsoft.Json;
-
-namespace Kyoo.Authentication
-{
- ///
- /// A container representing the response of a login or token refresh.
- ///
- public class JwtToken
- {
- ///
- /// The type of this token (always a Bearer).
- ///
- [JsonProperty("token_type")]
- [JsonPropertyName("token_type")]
- public string TokenType => "Bearer";
-
- ///
- /// The access token used to authorize requests.
- ///
- [JsonProperty("access_token")]
- [JsonPropertyName("access_token")]
- public string AccessToken { get; set; }
-
- ///
- /// The refresh token used to retrieve a new access/refresh token when the access token has expired.
- ///
- [JsonProperty("refresh_token")]
- [JsonPropertyName("refresh_token")]
- public string RefreshToken { get; set; }
-
- ///
- /// When the access token will expire. After this time, the refresh token should be used to retrieve.
- /// a new token.cs
- ///
- [JsonProperty("expire_in")]
- [JsonPropertyName("expire_in")]
- public TimeSpan ExpireIn { get; set; }
-
- ///
- /// The exact date at which the access token will expire.
- ///
- [JsonProperty("expire_at")]
- [JsonPropertyName("expire_at")]
- public DateTime ExpireAt { get; set; }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The access token used to authorize requests.
- /// The refresh token to retrieve a new access token.
- /// When the access token will expire.
- public JwtToken(string accessToken, string refreshToken, TimeSpan expireIn)
- {
- AccessToken = accessToken;
- RefreshToken = refreshToken;
- ExpireIn = expireIn;
- ExpireAt = DateTime.UtcNow + expireIn;
- }
- }
-}