Using CSOM to logout from SharePoint Online

Johan Eliasson 21 Reputation points
2021-06-15T09:03:13.65+00:00

I am able to login using this snippet:

https://github.com/pnp/powershell/blob/dev/src/Commands/Utilities/BrowserHelper.cs

but I can't figure out how to logout.

Do I delete cookies? Which ones? The clearClookies boolean in that snippet doesn't seem to accomplish anything at all. The first call to GetWebLoginClientContext(url, true) works fine, but the second call closes the login dialog immediately and logs me in automatically.

What should I do?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,159 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,784 questions
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 33,251 Reputation points Microsoft Vendor
    2021-06-17T09:49:12.207+00:00

    Hi @JohanEliasson-4523 ,
    Per my test, I got the same result as yours on my end. By default it will grab the cookie and attach to ClientContext.

    For this issue, I would suggest you open a new issue in github: https://github.com/pnp/powershell/issues


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful