Open Closed

Issues with verify email login redirect link #6337


User avatar
0
pablo@ccalp.net created
  • ABP Framework version: v7.4.0
  • UI Type: Angula
  • Database System: EF Core (SQL Server)

After verifying a user e mail the login link is taking me to the swagger page instead of the login page, how do I fix that?


15 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I remember that we have fixed the problem. could you try upgrading to the latest version to test it?

  • User Avatar
    0
    pablo@ccalp.net created

    I upgraded to 7.4.4 and still have the issue

    FYI: If I do it from the host it works, it only happens from a tenant

    domain.com --> OK tenant.domain.com ---> Not OK

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Can you share the logs when using tenant.domain.com?

    Especially the url in the email.

  • User Avatar
    0
    pablo@ccalp.net created

    This is the link that gets sent on the email:

    https://stoneledge.api.ccalp.net/Account/EmailConfirmation?userId=aaffb906-e621-3bf8-447a-3a0f73e8c224&__tenant=4946f7b1-d359-9962-e04d-3a0f73e8bc31&confirmationToken=CfDJ8BIvM4qjvL5NnmgtuRCj4m54s4w6tNaBHa7BpL0v03G3p8kB23aiCfyT0QLZjaemy9vxTbnr5U%2F8NW4cKFZn27ot0yXZInBqIZPSySiUrbNElYO0zazR889SQ6%2FFCk1bbSH8sbvWHk1D3C9jAKIdYMbdzLqJS%2FNKgAXQ2aUm1QqdVQ90f3YhDCuet4koM1ehDi3kgSiFq6jVpY0TE2cC70YMlgNK%2B9bW%2BJStwkwgtQwFBNu2qfe%2FPzyuJQNZUES1cg%3D%3D&returnUrl=https://stoneledge.ccalp.net/account/login

    I found the following in the logs:

    2023-12-15 04:14:47.273 +00:00 [INF] Executed endpoint 'Health checks' 2023-12-15 04:14:47.273 +00:00 [INF] The response could not be cached for this request. 2023-12-15 04:14:47.273 +00:00 [INF] Request finished HTTP/1.1 GET http://api.ccalp.net/health-status - - - 200 - application/json 9.9547ms 2023-12-15 04:14:47.277 +00:00 [INF] Received HTTP response headers after 18.9885ms - 200 2023-12-15 04:14:47.277 +00:00 [INF] End processing HTTP request after 19.1311ms - 200 2023-12-15 04:14:47.278 +00:00 [INF] Saved 2 entities to in-memory store. 2023-12-15 04:14:55.899 +00:00 [INF] Request starting HTTP/1.1 GET http://stoneledge.api.ccalp.net/Account/EmailConfirmation?userId=aaffb906-e621-3bf8-447a-3a0f73e8c224&__tenant=4946f7b1-d359-9962-e04d-3a0f73e8bc31&confirmationToken=CfDJ8BIvM4qjvL5NnmgtuRCj4m54s4w6tNaBHa7BpL0v03G3p8kB23aiCfyT0QLZjaemy9vxTbnr5U%2F8NW4cKFZn27ot0yXZInBqIZPSySiUrbNElYO0zazR889SQ6%2FFCk1bbSH8sbvWHk1D3C9jAKIdYMbdzLqJS%2FNKgAXQ2aUm1QqdVQ90f3YhDCuet4koM1ehDi3kgSiFq6jVpY0TE2cC70YMlgNK%2B9bW%2BJStwkwgtQwFBNu2qfe%2FPzyuJQNZUES1cg%3D%3D&returnUrl=https://stoneledge.ccalp.net/account/login - - 2023-12-15 04:14:55.899 +00:00 [INF] No cached response available for this request. 2023-12-15 04:14:55.905 +00:00 [INF] Executing endpoint '/Account/EmailConfirmation' 2023-12-15 04:14:55.916 +00:00 [INF] Route matched with {page = "/Account/EmailConfirmation", action = "", controller = "", area = ""}. Executing page /Account/EmailConfirmation 2023-12-15 04:14:55.916 +00:00 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2023-12-15 04:14:55.975 +00:00 [INF] Executing handler method Volo.Abp.Account.Public.Web.Pages.Account.EmailConfirmationModel.OnGetAsync - ModelState is "Valid" 2023-12-15 04:14:55.979 +00:00 [ERR] Invalid RedirectUrl: https://stoneledge.ccalp.net/account/login, Use AppUrlProvider to configure it!

  • User Avatar
    0
    pablo@ccalp.net created

    Let me know if you need the entire log file and how to upload it

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    [ERR] Invalid RedirectUrl: https://stoneledge.ccalp.net/account/login, Use AppUrlProvider to configure it!

    services.Configure<AppUrlOptions>(options =>
    {
        options.RedirectAllowedUrls.Add("https://{{tenantName}}.ccalp.net/");
    }
    
  • User Avatar
    0
    pablo@ccalp.net created

    This is what I have in my appsettings, should I add that one too?

    "App": { "SelfUrl": "https://{{tenantName}}.api.ccalp.net", "AngularUrl": "https://{{tenantName}}.ccalp.net", "CorsOrigins": "https://.ccalp.net,https://ccalp.net,https://app-compucare-api.azurewebsites.net", "RedirectAllowedUrls": "https://*.ccalp.net,https://ccalp.net,https://app-compucare-api.azurewebsites.net", "DisablePII": "false", "HealthCheckUrl": "https://api.ccalp.net/health-status" },

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Yes, the wildcard is {{tenantName}}

    https://{{tenantName}}.ccalp.net/

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    "RedirectAllowedUrls": "https://*.ccalp.net,https://ccalp.net,https://app-compucare-api.azurewebsites.net, https://{{tenantName}}.ccalp.net/",

  • User Avatar
    0
    pablo@ccalp.net created

    It's not working, still getting the same :

    2023-12-15 07:07:42.296 +00:00 [ERR] Invalid RedirectUrl: https://tenanta.ccalp.dev/account/login, Use AppUrlProvider to configure it!

    "App": { "SelfUrl": "https://{{tenantName}}.api.ccalp.dev", "AngularUrl": "https://{{tenantName}}.ccalp.dev", "CorsOrigins": "https://*.ccalp.dev,https://ccalp.dev,https://app-compucare-api-dev.azurewebsites.net", "RedirectAllowedUrls": "https://*.ccalp.dev,https://ccalp.dev,https://app-compucare-api--ev.azurewebsites.net,https://{{tenantName}}.ccalp.dev/", "HealthCheckUrl": "https://api.ccalp.dev/health-status" },

    private void ConfigureUrls(IConfiguration configuration)
    {
        Configure<AppUrlOptions>(options =>
        {
            options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
            options.Applications["Angular"].RootUrl = configuration["App:AngularUrl"];
            options.Applications["Angular"].Urls[AccountUrlNames.PasswordReset] = "account/reset-password";
            options.Applications["Angular"].Urls[AccountUrlNames.EmailConfirmation] = "account/email-confirmation";
            options.RedirectAllowedUrls.AddRange(configuration["App:RedirectAllowedUrls"].Split(','));
        });
    }
    
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I see, I will open a fix PR.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Your question credits has been Refunded

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You can override the IsRedirectAllowedUrl method of IAppUrlProvider to return the true.

  • User Avatar
    0
    pablo@ccalp.net created

    Could you please provide an example and where should I put that file?

    I created a class and implemented the IsRedirectAllowedUrl, but I needed to implement other methods too and now it fails when calling the other methods because they don't have a real implementation, I'm just returning a default value. Is there a way to just implement the IsRedirectAllowedUrl method?

    using System.Threading.Tasks; using Volo.Abp.DependencyInjection; using Volo.Abp.UI.Navigation.Urls; namespace CompuCare.Providers; public class CustomAppUrlProvider : IAppUrlProvider, ITransientDependency { public bool IsRedirectAllowedUrl(string url) { return true; } public async Task<string> GetUrlAsync(string appName, string urlName) { return default; } public async Task<string> GetUrlOrNullAsync(string appName, string urlName) { return default; } public async Task<string> NormalizeUrlAsync(string url) { return default; } }

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IAppUrlProvider))]
    
    using System.Threading.Tasks;
    using Volo.Abp.DependencyInjection;
    using Volo.Abp.UI.Navigation.Urls;
    namespace CompuCare.Providers;
    
    [Dependency(ReplaceServices = true)]
    [ExposeServices(typeof(IAppUrlProvider))]
    public class CustomAppUrlProvider : IAppUrlProvider, ITransientDependency
    {
        public bool IsRedirectAllowedUrl(string url)
        {
            return true;
        }
        
        public async Task<string> GetUrlAsync(string appName, string urlName)
        {
            return default;
        }
        
        public async Task<string> GetUrlOrNullAsync(string appName, string urlName)
        {
            return default;
        }
        
        public async Task<string> NormalizeUrlAsync(string url)
        {
            return default;
        }
    }
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09