1

so if a person goes to sharepoint online, logs in, how can I get the cookie that tells sharepoint later on that you are logged in so I can have something else use it and access sharepoint?

1 Answer 1

1

If I'm correctly understanding, you are asking how to programmatically get SharePoint auth cookies?

In .net you can use SharePoint Server 2013 Client Components SDK to get cookies see example below:

var login    = "admin@***.onmicrosoft.com";
var password = "P@ssw0rd";
var siteUrl  = "https://***.sharepoint.com/";

var creds = new SharePointOnlineCredentials(login, password);
var auth  = creds.AuthenticateAsync(new Uri(siteUrl), true);

var request = (HttpWebRequest)WebRequest.Create(siteUrl);
request.CookieContainer = auth.Result.CookieContainer;

var result = (HttpWebResponse)request.GetResponse();
3
  • can you do the same sort of thing is you ended up with a SAML token as well? Does that work the same way or no? I may have the option to get a SAML token from else where but not sure what to do with it afterwards.
    – Bigbacon
    Jul 26, 2014 at 16:16
  • and what you authenticated through your sharepoint URL first?
    – Bigbacon
    Jul 27, 2014 at 13:33
  • I don't see what you mean, could you explain in more detail?
    – Roman
    Aug 8, 2014 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.