Open Closed

Login with microsoft #8915


0
SRTMDEV created

Hello,

  • I am getting below msg after successfully getting token from microsoft and tried below test case Message: could not validate external user
  • already registred user with same email and email conformed.
  • alredy registred user with same email and email not conformed.
  • withour registred user.

Can you guide me what issue can be? I have also below question for external login providers.

  • We are using multi tenant and we set below URL's for our tenant, https://{tenancy_name}.sitename.com What should be right way to set redirect URL?

  • We also want a external login support for every tenant, where tenant can set thier own paramters for external login or they can integrate thier azure AD. What you suggest for this? Is this in your roadmap?

Thanks


13 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi @SRTMDEV,

    Could you share the entire error log message ? You can also follow this issue https://github.com/aspnetzero/aspnet-zero-core/issues/3191.

    When using https://{tenancy_name}.sitename.com, I'm not sure if Azure supports such a redirect URL. You can try https://*.sitename.com

    This is on our roadmap, please follow https://github.com/aspnetzero/aspnet-zero-core/issues/1051

  • 0
    SRTMDEV created

    He @ismcagdas,

    Azure is not allowing the wildcard character in URL. What could be other way to set redirect URL for all tenant?

    Find the below logs

    WARN  2020-04-24 05:46:13,379 [71   ] Mvc.ExceptionHandling.AbpExceptionFilter - Could not validate external user login
    Abp.UI.UserFriendlyException: Could not validate external user login
       at mandatly.Web.Controllers.TokenAuthController.GetExternalUserInfo(ExternalAuthenticateModel model) in F:\mandatly\aspnet-core\src\mandatly.Web.Core\Controllers\TokenAuthController.cs:line 517
       at mandatly.Web.Controllers.TokenAuthController.ExternalAuthenticate(ExternalAuthenticateModel model) in F:\mandatly\aspnet-core\src\mandatly.Web.Core\Controllers\TokenAuthController.cs:line 379
       at lambda_method(Closure , Object )
       at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    

  • 0
    ismcagdas created
    Support Team

    Hi,

    Could you check if you have correct values for model.AuthProvider and model.ProviderAccessCode in https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Core/Controllers/TokenAuthController.cs#L511 ?

    Azure is not allowing the wildcard character in URL. What could be other way to set redirect URL for all tenant?

    Sorry, I don't know. You might contact with Azure about this.

  • 0
    SRTMDEV created

    Hi,

    This code is already exist in tokenauthcontroller.

    I also test with debug i got this result in providerKey model.ProviderKey 000000008a21451985545026d3b66560 userInfoKey 00000000-8a21-4519-8554-5026d3b66560 Issue in dashes the userInfor.ProviderKey value with dash. I resolve the issue.

    After successfully recived token and got message for email activation and after that admin activate the email however i am stil not able to login i got below message,

    I also try with already registred Email. I recieved message "email is already taken".

    I should be able to login with microsoft token if my email is already registred in application. How can i fix this?

    Thanks

  • 0
    ismcagdas created
    Support Team

    Hi @SRTMDEV

    Is it possible for your to share your project and provide test credentials for microsoft login for us to test this problem ?

    Thanks,

  • 0
    SRTMDEV created

    Hi,

    I used default aspnetzero project v8.6.0 , setup microsoft login. You can try with default project i didn't change anything.

  • 0
    ismcagdas created
    Support Team

    Hi @SRTMDEV

    Thanks, will try and inform you again.

  • 0
    SRTMDEV created

    Hi @ismcagdas

    Any update? Thanks.

  • 0
    ismcagdas created
    Support Team

    Hi @SRTMDEV

    I have tried this and couldn't reproduce the problem. But, I have tried with Azure AD Account. Do you use office 365 Microsoft accounts ?

    Thanks,

  • 0
    SRTMDEV created

    Yes. I am using/registred both azure AD and office 365. Thanks

  • 0
    ismcagdas created
    Support Team

    Hi,

    Does that work with Azure AD users ?

  • 0
    SRTMDEV created

    No,

    Not work with Azure AD user and also not work with office365.

  • 0
    ismcagdas created
    Support Team

    Hi @SRTMDEV,

    Is it possible for you to share a projetc which we can reproduce this problem ? I have tried and it works for me.

    Thanks,