ipad safari browser not clearing cookies - jquery-mobile

I am developing mobile web application using Jquery Mobile and MVC 3. I am using FormsAuthentication for the user authentication. Here is my code for Login button click
AuthenticationResult authResult = this.membershipService.Authenticate(username, password, remoteAddress);
if (authResult.IsAuthenticated)
{
FormsAuthentication.SetAuthCookie(username, false);
}
authResult.RedirectAction + " To JSON Object");
return Json(new
{
action = "Index",
});
On logout button i have written the code
public ActionResult LogOff()
{
FormsAuthentication.SignOut();
Response.Cookies.Clear();
return RedirectToAction("Index", "Home");
}
This is working fine on windows machine safari browser
When i open my application on iPad safari browser:
Give login crendential and click ok, it is redirecting me to the appropriate screen.
Log out and Close the safari browser on iPad
Reopen the safari browser and do the step 1, this time it is
redirecting me to Login screen.
I have to clear the browser cookies thn only it is redirecting me to
appropriate screen
I also clear the cookies on Login Screen but it is not working. Can someone help me out here?

Related

Adobe Sign Oauth 2 popup login button disabled

I'm working on an application that requires OAuth2 authentication for Adobe Sign. I'm able to open a popup with a login screen for Adobe Sign like so:
axios.get(`https://secure.na3.adobesign.com/public/oauth/v2?redirect_uri=${redirect_uri}/auth&response_type=code&client_id=${client_id}&scope=user_login`)
.then(res => {
// open new window
var myWindow = window.open('', 'newWindow', "width=500,height=700");
// render html from response in new winsow
myWindow.document.body.innerHTML = res.data
}
The issue is that the login button does not do anything after entering my credentials. The redirect URI in the parameters is listed in my application settings as a redirect URI, so it should be redirecting the user to that uri with the authorization code.
Also of note -- the "signup for a free trial" button in the popup works, but the "forgot my password" button also seems to be disabled.
I'm wondering if this is happening because my redirect URI is https (it has to be for an adobe sign application) and I'm testing it from http://localhost

How Request.IsAuthenticated work in mvc4 exactly

I made 2 MVC Project that use login form before start
I use this code for login
public ActionResult Login(AccountLog Usr)
{
AccountLog personindatabase = db.AccountLogs.FirstOrDefault(m => m.Usercode == Usr.Usercode);
FormsAuthentication.SetAuthCookie(personindatabase.UserName, true);
ViewBag.id = personindatabase.Usersid;
return RedirectToAction("Main", "Main");}
when I run program at I check first if(Request.IsAuthenticated) if true return view if else redirect to login page as this
public ActionResult Main()
{
if (Request.IsAuthenticated)
{
return View();
}
return RedirectToAction("Login", "Account");
}
it worked fine but I noticed that if I run the first program and made success login and close it not made logout and run the second program that not logged yet it open as it logged person this mean if i made login from the first one and open the second it will open fine and vise versa how can i differentiate between 2 project login how can i made alternative for Request.IsAuthenticated if any thing in question don't clear leave comment to clear it to be able to help me
From what you just described you are trying to login to the same application using the same browser session in two different tabs without logging out the first user.
When a login is a success an Authentication Cookie is set in the browser. This cookie is sent to the server each time so that the server can validate the user.
As you are trying to login ( or expect to login) into the second tab using another account, you already see the first user logged in as the Authentication Cookie for that account still persisted in the browser. The Authentication cookie will expire only when the user logs off.
So you can either.
Test two accounts using two different browsers(e.g. Chrome and Firefox)
Log off the first account before trying to login using another account in the same browser.
Hope that helps!

OAuth 2 Owin not working StackExchange.Redis SessionState

Starting with a fresh, new MVC5 Project I hooked up External OAuth Login with Google, Facebook Twitter, Microsoft etc. All is working as expected.
I then added the new ASP.NET Session State Provider for Redis Preview Release and have it working. Yeah!
I soon noticed that attempting to login using any of the OAuth providers no longer works properly. The Google & Facebook login buttons calls the ExternalLoginCallback(string returnUrl) on the Accont controller but goes nowhere. The login page simply refreshes.
The LinkedIn, Twitter, and Microsoft buttons all direct the user to those login pages but when returned back to my application they return to the login page and no user is added to the system.
Commenting out the custom sessionState entry in my web.config returns the external login back to normal.
Considering both frameworks are black-boxes to me I am not sure how to go about geting these two to play together.
this helped me with the exact issue.
http://www.nsilverbullet.net/2014/06/24/tough-mvc-5-owin-external-authentication-issue/
basically:
Must Have Session State? in AccountController modify:
[AllowAnonymous]
public ActionResult Login(string returnUrl)
{
//Ensure Session has at least one value
Session["EnableExternalAuth"] = true; // <--------- This helped
ViewBag.ReturnUrl = returnUrl;
return View();
}
There seem to be an issue with sessions and external login providers

"Connect With twitter" for mobile websites

I am using #Anywhere code to implement the twitter signup functionality for my website
twttr.anywhere(function (T) {
document.getElementById("signin-btn").onclick = function () {
T.signIn()
};
});
Above written is my code to put "Connect with twitter" button on my website.
It redirects me to http://oath.twitter.com/................
and open a regular web page of twitter login for desktop browsers.
instead of the desktop size login page I want to open the mobile version of login page, as my website users will be the mobile users.
So they open my page in mobile, so i want twitters mobile version page to be opened
How can i do this.
It should redirect mobile users to a mobile page automatically. Have you tried testing it on a mobile? Or try setting your browser's User Agent to that of a phone.

how could i differentiate normal logout or facebook logout in asp.net mvc

I am trying to integrate facebook with in my asp.net mvc web application using Graph Api. I am successfully logged in to facebook and i got the cookie. but when an user clicks on logoff i want to perform a condition to go for facebook logout or my website logout like,
if(Facebook Logout)
{
return new RedirectResult("http://www.facebook.com/logout.php?api_key=XXX..");
}
else if(My Webapp logout)
{
Session.RemoveAll();
FormsAuthentication.Signout();
return RedirectToAction("Index","Home");
}
so what is the condition for whether user needs to be logout from (facebook and app) or logout from app only. How could i determine whether user connected to facebook or not.
One possible solution is Creating a session/cookie when u log-in using facebook and while log-out you can check if the cookie/Session exist and log out according

Resources