How to Sign-Out from an authenticated ListDataProvider/Authenticator in Windows Phone 8 - authentication

I am reading a SharePoint list from Office 365 inside a Windows Phone 8 app. My app-code is based on this sample code from Microsoft. It uses
Microsoft.SharePoint.Phone.Application.ListDataProviderBase
Microsoft.SharePoint.Client.ClientContext
Microsoft.SharePoint.Client.Authenticator
The actual problem beeing signout not working!
On the first request to the server, the client asks for authentication and shows a hosted browser window where I can enter my account credentials. I select to stay logged in here.
If i restart the app, it authenticates me without showing the UI again.
I would like to be able to switch user or simply signout leaving no credentials on the phone behind.
I found the following static methods on Authenticator which do not change anything:
Authenticator.ClearAllCookies();
Authenticator.ClearAllCredentials();
Authenticator.ClearAllApplicationSettings();
What is the prefered way to do this?

This is an example of how I am logging out a user in my SP list App for WP8:
App.MainViewModel.IsInitialized = false;
Authenticator.ClearAllCredentials();
App.MainViewModel.Initialize();
MessageBox.Show("You have been successfully logged out, click refresh to login again.");
Your app maybe a little different, but you should at least get to the App and ViewModel to set Initialized as false. I did expxect the App.MainViewModel.Initialize() to show the login page but need to click refresh after calling this SignOut method to do so, that is why I displayed the messagebox.
Hope this helps you.

Related

WebView2 - SSO, Recognize Login, or Persist Cookies/Identity

I am running into an issue, working win WebView2 in a WPF application.
The one complaint we are getting from users is that the MS login gets 'forgotten' after the browser window closes, requiring that they login via a popup MS window on subsequent webview loads, and click on their identity. If a webview2 app that has already stored the user identity is open, it seems to reuse that authentication.
Is there a way to persist that login, so that after the window closes, subsequent windows reuse that login, along with maybe an expiration on the file(s) that have that information?
Some thoughts:
Prevent the deletion of the files providing identity
Launching and hiding a window that would persist the identity (very old-school)
Find a parameter that enables it to login automatically
I've already tried setting the environment variable for AllowSingleSignOnUsingOSPrimaryAccount, but that didn't work.
It is using Fixed Binaries, so passing a relative path.
var options = new CoreWebView2EnvironmentOptions(default, default, default, true);
string installPath = #"./Microsoft.WebView2.FixedVersionRuntime.91.0.864.48.x86";
CoreWebView2Environment env = await CoreWebView2Environment.CreateAsync(installPath, userFolder, options);
await this.webView.EnsureCoreWebView2Async(env);

xcode twitter api authorize screen issue

I have an app that I'm using the xcode IDE and writing in Objective-C that uses the twitter api and the 'default' twitter login page for username and password.
I already have all the oauth stuff set up and it is working fine.
I create a new view controller with a web view inside it, and pass the URL of https://api.twitter.com/oauth/authorize.
If I put in my email and password, everything works fine - the view disappears, and we are then off and running.
If I press cancel on the twitter login screen, I get a twitter page saying I need to log in. I need to capture the cancel in my code so I can dismiss the view controller, but I cannot find out what the name of the callback is? I tried didFailLoadWithError but that is not it.
Can someone shed some light on this please?
It turns out it can be handled from the same callback that handles a 'correct' login. except looking for a failure.
So, they have handled it correctly within the original callback.

How to set auto login in windows 8 app

I need to keep a auto login to my windows8 app. When user login with email and password i need to store in local and next time when app opened those details need to be auto filled.
I am new to these apps so please provide some code lines
Thanks
Ak
Instead of building your own login functionality from scratch you could use the Microsoft account sign in. Have a look at this: http://msdn.microsoft.com/en-us/library/windows/apps/jj193591.aspx
and this: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/Hh968445(v=win.10).aspx

Office 365 JavaScript API, redirect back to WP app after launching Store

I am creating a Windows Phone app using HTML And JavaScript. I am able to add connected services and have selected "Users and Groups" and given it Read permissions.
I am then making the following calls on button click:
var authContext = new O365Auth.Context();
authContext.getIdToken("https://TestDomain.onmicrosoft.com/TestWebApi").then(
function (token){
}
);
Services/Office365/Settings.js has been edited to the following:
Settings.clientId = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
Settings.authUri = "https://login.windows.net/common/";
Settings.redirectUri = "ms-app://s-1-15-2-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx/";
I got the redirectUri value by calling the following function:
Windows.Security.Authentication.Web.WebAuthenticationBroker.getCurrentApplicationCallbackUri();
I do get the login screen for my organization and I am able to provide credentials and it tries to redirect it back to my application, but then I get asked the following question:
"You need to install an app for this task. Would you like to search for one in the Store?"
If I click on yes, it takes me to the store and says "No apps found". If I click on no, it doesn't do anything.
How could I possibly get it redirected back to my app?
The connected services experience only works in Multi-device hybrid apps (a.k.a. Cordova), not in Windows Phone apps.

Sorry, something went wrong after cancel application connexion on SDK 3.0

I'm using the new PHP SDK 3.0 and I use the new getLoginUrl() function with the following parameters.
$paramsLogin = array(
'scope' => PERMISSIONS,
'redirect_uri' => REDIRECT_URI
);
If the user clicks "cancel" on the application permissions popup, I redirect the user on an error page which contains a message explaining that he has to accept the permissions in order to participate to the contest and a new login button.
But when i click on the login button again, facebook displays the following message :
Sorry, something went wrong. We're working on getting this fixed as
soon as we can.
If I wait for a while then click again on the login button It works as expected.
I read somewhere that facebook should be displaying "Leave application" in the permission popup instead of "Cancel" I guess this is the issue.
Anyone has any clue on how to solve that problem or should I submit a bug report on facebook.
This is currently open as a bug in Facebook's bug tracker, see here: https://developers.facebook.com/bugs/287587111265733 - I reproduced it myself earlier, and it's been assigned for fixing
I believe if you wait a while the dialog works again (i.e the failure only happens if you go back to the dialog quickly after rejecting it, which shouldn't really happen except when aggressively testing).