Skip to main content
Added ".net" tag.
Link
Steve
  • 107
  • 3
  • 13
Source Link
Steve
  • 107
  • 3
  • 13

How to get cookies after obtaining Azure AD access token to SharePoint Online

I have been able to successfully use the ADAL library to obtain an access token to SharePoint Online and execute CSOM queries. When I try to access a SharePoint Online URL directly using a WebRequest, I get a 401 error even though I am setting the authentication header with my bearer token.

When I manually use a web browser to access the URL, everything works. Upon further digging with Fiddler, I see the browser is somehow receiving/using the "rtFa" and "FedAuth" cookies. How can I do the same?