Connecting the login flow between Android/iPhone app and the web - iphone

When the person opens my app, I want to display a button. The user clicks this button, and it opens a browser (embedded, of course) inside the app, allowing the user to LOGIN through that web page.
Of course, when the person logs in, it only logs in to that web server. The web service now knows that the user is logged in.
As the user uses my mobile app, I need to know if he's logged in or not. How can I know? There's no way for my app to determine if the user is logged into my web service.
By the way, I am using Django framework for my web service.

Well, presumably when your user logs in the server is telling their browser to set a cookie. Why not just capture this cookie and use it to determine if they successfully logged in?

Related

How to retrieve Logged In User’s Credentials from device

I have a login page in my Ionic App. The current behavior of the app is as below:
After downloading the app, User launches it.
The app shows Login Options (buttons) page (right now, I only have Microsoft (Azure Active Directory)).
Tapping any of the options, the app asks for login credentials (email and password).
The app authenticates these credentials against the server/corresponding vendors.
Upon successful authentication, the user is taken to Home Page of the app.
Now the important part, for all the subsequent launches, when the user taps on the 'Microsoft' (again, this is the only option I have right now) button it doesn't ask for credentials (emails ID and password). Instead it takes the User to Home Page directly.
So, I am sure the user credentials and/or its corresponding token or something similar is being maintained in the device somewhere.
How do I access this information programmatically?
What I am trying to achieve is: If the user credentials/token already exist on the device then don't even shot the Login Options Page. Take the user to the Home Page directly after the app is launched.
Any ideas/pointers/suggestions on how this can be done.
Thank you!

Windows Phone 8 Facebook SDK for .NET Logout

I was able to successfully login to Facebook and get required permissions for my Windows Phone 8 application using the tutorial here -
http://facebooksdk.net/docs/phone/controls/login-ui-control/
Now, the login button control opens up a browser window and asks the user to login.
Then the user logins and grants permissions to my app.
Then the user is redirected back to my app on the phone and sees the login button changed to logout button.
When the user will click on the logout button, the session data is removed from the loginbutton control. So my app sees the user as logged out.
But when the user logs in again, he is not asked for his credentials and is directly logged in to his account - this is because the user actually never logged out of the web browser window in the Windows Phone application.
So how do I logout the user from the browser control in my Windows Phone 8 application.
All help is greatly appreciated!
The user is not asked for his credentials because the Facebook authentication cookie is still present in the WebBrowser control.
So to completely logout the user from Facebook, you need to clear the WebBrowser cookies.
Unfortunately, there is no easy way for erasing cookies on Windows Phone 7.
On Windows Phone 8 you just need to call ClearCookiesAsync:
await new WebBrowser().ClearCookiesAsync();
Here is a tutorial that makes use of it: http://www.developer.nokia.com/Community/Wiki/Integrate_Facebook_to_Your_Windows_Phone_Application

Mobile Website Facebook Login using Facebook App for login details

Using a web browser e.g. Chrome on Android, if a mobile website requires a user to be logged in to Facebook and they are not, the browser will ask for Login details even though the phone may be logged in to Facebook via the Facebook native App. Is there any way to get details from the Facebook App without the user having to log in again?
If you want to login in website in a browser, using Facebook account from Facebook app - it is impossible, without intermediary application, or service. And even with it, I don't think, that you can get user login data.
Other approach - is try to launch Facebook app from your site, and show site from it, but again, you can't login to it, using app.
Why? Because the app, holds only token data, and nothing more. You can't get other information, like password, or email. Also, the work of browser, that save cookies and the app, that save token is different. You can't connect them together.
Clearly speaking it is not possible using website in browser.
Even it is also not possible if you develop any android app, the reason is that the facebook app will not share any data to any other app (even if it is running on the same device).
I also don't think that launching the facebook app from browser will be feasible for you, as you just want to use the facebook login system and then want the users back on your website (and again facebokk will not send any data to your web or app even if it is launched from your web or app).
I think it's not possible, because we wont link browser and an app.
I developed one android app with facebook login integration.If facebook native app already logged in, now i click my app facebook login button it directly redirect my app to my home page without asking fb username and password.
For me i used localStorage in javascript
localStorage.setItem("userName", userName);
localStorage.setItem("password", password);
var uname=localStorage.getItem('userName');
var pass=localStorage.getItem('password');

How to become redirected to Facebook's Mobile Web URL

I would like to integrate an existing, external application with Facebook using Mobile Web method and its authenticated referrals as well as to be able to redirect user (incoming from a different place) to Facebook login page. I do not want it to be embedded in Facebook page.
If I understand correctly how the authenticated referrals work, I must somehow reach the authentication dialog which will redirect me to the Mobile Web URL, which I specified in the application configuration.
Additional information: I would like to avoid making the application public until it is ready, so I have set the Sandbox Mode setting to Enabled.
How to get the URL, with which I will be able to test authenticated referrals?
You can land at your game's Mobile Web URL page using following steps:
Switch your user agent to iPhone or other mobile.
Go to the http://m.facebook.com page.
Press the "identity" icon in the top left edge of the screen to show the bookmarks menu.
Look for the application in the Apps section.
Press the application bookmark.
Above procedure worked for me. My user was an admin of the project but it will probably work also for devs and testers (just a guess).

How to call back to the application from Safari browser when successfully logged in?

I am using webservice in my app. I have set one button login with facebook button, that drag user to safari browser and open facebook login page. Here I have not used Facebook API, all things are coming from PHP side,
now I need the user back to application which is in background when he successfully Logs in..
I have set my URL schemes as "myapp" and when user logs in successfully in PHP side I have set url to open is "myapp://" so I can get back to my app.
But here problem is when ever url "myapp://" gets called it automatically converted to "http://domainname.myapp://" so safari is not letting the user to go back to application and it stays on the bowser.
where I am getting wrong?