diff --git a/coffeecard/CoffeeCard.Common/Configuration/EnvironmentSettings.cs b/coffeecard/CoffeeCard.Common/Configuration/EnvironmentSettings.cs
index e833157d..06b7a91c 100644
--- a/coffeecard/CoffeeCard.Common/Configuration/EnvironmentSettings.cs
+++ b/coffeecard/CoffeeCard.Common/Configuration/EnvironmentSettings.cs
@@ -17,6 +17,9 @@ public class EnvironmentSettings : IValidatable
[Required]
public string ShiftyUrl { get; set; }
+ [Required]
+ public string AnalogAppUrl { get; set; }
+
public void Validate()
{
Validator.ValidateObject(this, new ValidationContext(this), true);
diff --git a/coffeecard/CoffeeCard.Library/Services/v2/EmailService.cs b/coffeecard/CoffeeCard.Library/Services/v2/EmailService.cs
index 18a4745d..0d01c195 100644
--- a/coffeecard/CoffeeCard.Library/Services/v2/EmailService.cs
+++ b/coffeecard/CoffeeCard.Library/Services/v2/EmailService.cs
@@ -38,14 +38,14 @@ public async Task SendMagicLink(User user, string magicLink, LoginType loginType
);
var message = new MimeMessage();
var builder = RetrieveTemplate("email_magic_link_login.html");
- var baseUrl = loginType switch
+ var baseUri = loginType switch
{
LoginType.Shifty => _environmentSettings.ShiftyUrl,
- LoginType.App => throw new NotImplementedException(),
+ LoginType.App => _environmentSettings.AnalogAppUrl,
_ => throw new NotImplementedException(),
};
- var deeplink = loginType.GetDeepLink(baseUrl, magicLink);
+ var deeplink = loginType.GetDeepLink(baseUri, magicLink);
builder = BuildMagicLinkEmail(builder, user.Email, user.Name, deeplink);
diff --git a/coffeecard/CoffeeCard.Models/Entities/LoginType.cs b/coffeecard/CoffeeCard.Models/Entities/LoginType.cs
index bd833a8a..486951b1 100644
--- a/coffeecard/CoffeeCard.Models/Entities/LoginType.cs
+++ b/coffeecard/CoffeeCard.Models/Entities/LoginType.cs
@@ -30,15 +30,20 @@ public static class LoginTypeExtensions
/// Get the deep link for the correct application
///
/// The application to log in to
- /// The base URL for the application
+ /// The redirect URI for the application
/// The generated token associated with a user
/// string
/// Unable to resolve application to log in to
- public static string GetDeepLink(this LoginType loginType, string baseUrl, string tokenHash)
+ public static string GetDeepLink(
+ this LoginType loginType,
+ string redirectUri,
+ string tokenHash
+ )
{
return loginType switch
{
- LoginType.Shifty => $"{baseUrl}auth?token={tokenHash}",
+ LoginType.Shifty => $"{redirectUri}auth?token={tokenHash}",
+ LoginType.App => $"{redirectUri}://login/auth/{tokenHash}",
_ => throw new ApiException(
"Deep link for the given application has not been implemented"
),
diff --git a/coffeecard/CoffeeCard.WebApi/appsettings.json b/coffeecard/CoffeeCard.WebApi/appsettings.json
index 647f6ea1..f1132785 100644
--- a/coffeecard/CoffeeCard.WebApi/appsettings.json
+++ b/coffeecard/CoffeeCard.WebApi/appsettings.json
@@ -7,7 +7,8 @@
"EnvironmentType": "LocalDevelopment",
"MinAppVersion": "2.0.0",
"DeploymentUrl": "https://localhost:8081/",
- "ShiftyUrl": "https://localhost:8001/"
+ "ShiftyUrl": "https://localhost:8001/",
+ "AnalogAppUrl": "https://localhost:8001/"
},
"DatabaseSettings": {
"ConnectionString": "Server=localhost;Initial Catalog=master;User=sa;Password=Your_password123;TrustServerCertificate=True;",
diff --git a/infrastructure/dev.settings.json b/infrastructure/dev.settings.json
index f0d236f0..57714789 100644
--- a/infrastructure/dev.settings.json
+++ b/infrastructure/dev.settings.json
@@ -25,6 +25,10 @@
"name": "EnvironmentSettings__ShiftyUrl",
"value": "https://shifty.dev.analogio.dk/"
},
+ {
+ "name": "EnvironmentSettings__AnalogAppUrl",
+ "value": "cafeanalog-dev://cafeanalog.dk/"
+ },
{
"name": "MailgunSettings__Domain",
"value": "mg.cafeanalog.dk"
diff --git a/infrastructure/prd.settings.json b/infrastructure/prd.settings.json
index a80fb69c..4b5b143c 100644
--- a/infrastructure/prd.settings.json
+++ b/infrastructure/prd.settings.json
@@ -25,6 +25,10 @@
"name": "EnvironmentSettings__ShiftyUrl",
"value": "https://shifty.prd.analogio.dk/"
},
+ {
+ "name": "EnvironmentSettings__AnalogAppUrl",
+ "value": "cafeanalog://cafeanalog.dk/"
+ },
{
"name": "MailgunSettings__Domain",
"value": "mg.cafeanalog.dk"