Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am working in UWP and could not able to get cookies response for sharepoint authentication. Priviously i was worked on windows app i achieved it here but the same code not working for UWP app.
Any help is appreciated.

What I have tried:

private async Task<SPOAuthCookies> GetSPOAuthCookies(SamlSecurityToken stsToken)
    {

        Uri siteUri = this.spSiteUrl;
        Uri wsSigninUrl = new Uri(String.Format("{0}://{1}/{2}", siteUri.Scheme, siteUri.Authority, spowssigninUri));
        var clientHandler = new HttpClientHandler();

        await HttpUtility.SendHttpRequest(
            wsSigninUrl,
            HttpMethod.Post,
            new MemoryStream(stsToken.BinarySecurityToken),
            "application/x-www-form-urlencoded",
            clientHandler);

        SPOAuthCookies spoAuthCookies = new SPOAuthCookies();
        spoAuthCookies.FedAuth = clientHandler.CookieContainer.GetCookies(wsSigninUrl)["FedAuth"].Value;
        spoAuthCookies.RtFA = clientHandler.CookieContainer.GetCookies(wsSigninUrl)["rtFA"].Value;
        spoAuthCookies.Expires = stsToken.Expires;
        spoAuthCookies.Host = wsSigninUrl;

        return spoAuthCookies;
    }


my code breaks from this line
this works fine in windows app

spoAuthCookies.FedAuth = clientHandler.CookieContainer.GetCookies(wsSigninUrl)["FedAuth"].Value;
Posted

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