Click here to Skip to main content
15,878,945 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How do i use google auth with mvc4 and javascript to redirect to another page with name on successful login ?

Am trying to do google sign in on my web application. I could do this using javascript. But i want to redirect to another page on successful login.

See below javascript.
JavaScript
function signinCallback(authResult) {
  if (authResult['status']['signed_in']) {
   
    //Here i want to redirect to another page with username. How i do this?
  } else {
    alert('Sign in failed');
  }
}


For successful login i want to redirect to another page. In that page i want to show user name. I can not pass username as query string.If i pass it as query string people can enter the url with that query string in browser directly right? So what i can do in this case??

JavaScript
if (authResult['status']['signed_in']) {

   //If i pass username in querystring it will be like
   window.open("htp://local/usrepage/name='test'");
 }

but people can enter this directly as well like: htp://local/usrepage/name='test'
on userpage we can not do any validation on this right?

Can i take these javascript values in to my C# code in my view or controller?

Any suggestions ?
Posted
Updated 12-Apr-15 21:45pm
v2
Comments
Nikunj Bhanushali 14-Apr-15 7:02am    
If I was using javascript for O-Auth I would only use javascript. If I was uising MVC then I would only use MVC.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900