Laravel Developer
David Carr
Web Developer
All Posts Archives Categories Authors
About Books Packages Templates Contact
Blog
All Posts Archives Categories Authors
About Books Packages Templates Contact
Laravel Microsoft Graph
Laravel Packages
Laravel Microsoft Graph Laravel Xero Laravel Sent Emails Laravel Dropbox Laravel Box Laravel Companies House Laravel Countries Laravel Eventbrite Laravel Blade Components
PHP Packages
PDO Wrapper PHP find and replace JSON SQL Import IMAP Export CSV Pagination
v3 v4
Navigation
  • Introduction
  • Install
  • Delta
  • MsGraph
    • Is Connected
    • Disconnect
    • Middleware
    • Queues
    • Login with MsGraph
    • Contacts
    • Emails
    • Files
    • Filesystem
  • MsGraph Admin
    • Middleware
    • Contacts
    • Emails
Navigation
  • Introduction
  • Install
  • Delta
  • MsGraph
    • Is Connected
    • Disconnect
    • Middleware
    • Queues
    • Login with MsGraph
    • Contacts
    • Emails
    • Files
    • Filesystem
  • MsGraph Admin
    • Middleware
    • Contacts
    • Emails

Disconnect

To disconnect from MsGraph call a ->disconnect() method.

The disconnect will send a POST request to MsGraph to revoke the connection, in addition, the stored token will be deleted.

MsGraph::disconnect($redirectPath = '/', $logout = true);

Passing $logout = true will do an auth()->logout call $redirectPath will be used to determine where to redirect to after disconnecting from Graph.

Typically, you only want to run this is there is a connection, so it makes sense to wrap this in a ->isConnected() check:

if (MsGraph::isConnected()) {
    MsGraph::disconnect();
}

DCBlog

Practical tutorials, code snippets, and in-depth guides for modern web development. Helping developers build better applications since 2009.

Subscribe to my newsletter for the latest updates on my books and digital products.

© 2009 - 2025 DC Blog. All rights reserved.

Privacy Policy • Terms of Service