vendredi 3 juillet 2020

Redirect to another page after succesfull authorization in asp.net core web api

I have simple jwt-token authorization.But I don't know how to redirect to page after successful authorization.I use ASP.NET Core 3.1 web api and simple JavaScript.I need redirection to google.com for instance.This is my controller method that checks token

 public class AuthController : Controller
{
    [Authorize]
    [Route("getlogin")]
    public IActionResult GetLogin()
    {
        return Ok();
    }
}

And this is my javascript

 const token = sessionStorage.getItem(tokenKey);

 const response = await fetch("https://localhost:44369/Auth/getlogin", {
     crossDomain: true,
     method: "GET",
     headers: {
         "Accept": "application/json",
         "Authorization": "Bearer " + token 
     }
 });



Aucun commentaire:

Enregistrer un commentaire