'How to set callback URL in .NET API?

I'm trying to make an option to reset the password through MailJet. where the forgot_password method will send a URL with a PasswordResetToken to the mail.

I have tried for MVC app using this way.

var code = await  _userManager.GeneratePasswordResetTokenAsync(user!);
var callbackUrl = Url.Action("ResetPassword", "Account", new {userId = user.id, 
    code= code }, protocol:HttpContext.Request.Scheme);

await _emailSender.SendEmailAsync(model.Email, "Reset Password",
        "reset your password by clicking " + callbackUrl);

Now I'm trying to do the same thing for the API app. how can I do that? What will be the callbackUrl here?

Note: I'm writing all code in service instead of controller.

var code = await _userManager.GeneratePasswordResetTokenAsync(user!);
var callbackUrl = " ";

await _emailSender.SendEmailAsync(model.Email, "Reset Password",
        "reset your password by clicking " + callbackUrl);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source