Skip to main content
All docs
V25.2
  • UserManager.FindUserByLogin<TUser>(IObjectSpace, String, String) Method

    Finds an application user based on the specified user login information.

    Namespace: DevExpress.ExpressApp.Security

    Assembly: DevExpress.ExpressApp.Security.v25.2.dll

    NuGet Package: DevExpress.ExpressApp.Security

    Declaration

    public TUser FindUserByLogin<TUser>(
        IObjectSpace objectSpace,
        string loginProviderName,
        string providerUserKey
    )
        where TUser : class, ISecurityUserWithLoginInfo

    Parameters

    Name Type Description
    objectSpace IObjectSpace

    An Object Space used to search for a user.

    loginProviderName String

    The name of the login provider for which to find a user.

    providerUserKey String

    The user key for the specified login provider.

    Type Parameters

    Name Description
    TUser

    The user object type.

    Returns

    Type Description
    TUser

    The resulting user object.

    Remarks

    The following code snippet demonstrates how to use the FindUserByLogin method to find a user based on their login information for the specified login provider:

    using DevExpress.ExpressApp.Security;
    using Microsoft.Extensions.DependencyInjection;
    // ...
    // Use Dependency Injection to access the IServiceProvider.
    var userManager = serviceProvider.GetRequiredService<UserManager>();
    ApplicationUser user = userManager.FindUserByLogin<ApplicationUser>(os, "MyCustomLoginProvider", providerUserKey);
    
    See Also