#oauth changed GoogleController for the jwt flow ( using a common token if we connect from our app or from google )

This commit is contained in:
Dominic Villemure
2024-06-09 23:44:37 -04:00
parent ac87aeb4c4
commit 6f76cb2084
16 changed files with 338 additions and 842 deletions

View File

@@ -0,0 +1,27 @@
using Hutopy.Application.Common.Interfaces;
namespace Hutopy.Application.Users.Commands;
public record LoginCommand : IRequest<string>
{
public required string EmailAddress { get; init; }
public required string Password { get; init; }
}
public class LoginCommandHandler : IRequestHandler<LoginCommand, string>
{
private readonly IApplicationDbContext _context;
private readonly IIdentityService _identityService;
public LoginCommandHandler(IApplicationDbContext context, IIdentityService identityService)
{
_context = context;
_identityService = identityService;
}
public async Task<string> Handle(LoginCommand request, CancellationToken cancellationToken)
{
var jwt = await _identityService.LoginAsync(request.EmailAddress, request.Password);
return jwt ?? "Invalid login credentials";
}
}