Click here to Skip to main content
15,891,908 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I am developing a Windows Store App which requires user to authenticate using Yammer credentials. I have written the following code to achieve the functionality
C#
var client_id = <<My Client ID >>;
            var client_secret = <<My Client Secret>>;
           
            string redirectURI = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString();
            string loginURI = "https://www.yammer.com/dialog/oauth?client_id=" + client_id + "&redirect_uri=" + redirectURI;
            
            var result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, new Uri(loginURI), new Uri(redirectURI));
            if (result.ResponseStatus == WebAuthenticationStatus.Success)
            {
                var response = result.ResponseData;
                string[] keyValPairs = response.Split('=');
                HttpClient client = new HttpClient();
                string url = "https://www.yammer.com/oauth2/access_token.json?client_id=" + client_id + "&client_secret=" + client_secret + "&code=" + keyValPairs[1];
                HttpResponseMessage JSONresponse = await client.GetAsync(url);
                string content = await JSONresponse.Content.ReadAsStringAsync();
}

When I ran the app for the first time it asked me for my credentials and I was able to login.

Now when I run my app , it takes my previous entered credentials and logs in automatically. I am sure that I did not check "Keep Me signed In" option.

I want the app to ask for credentials every time I run it.

Please help and thanks in advance.
Posted
Updated 1-Jan-14 19:19pm
v2

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