Logout Hubspot programmatically



For apps that uses oauth to access Hubspot API and data, if the user check the box to stay logged in, next time logging in the user will be redirected to the access rights page without needing to input account and password. Is there a programmatical way to logout Hubspot entirely so the user will have to re-input account and password again next time? Thanks!


@coffeeocean can you tell me more about why you’d want to force a HubSpot user to log out? We don’t have a programmatic way to do that, and generally we’d want to respect the user’s login preference. Also, if your app is storing the refresh token you’d get from the OAuth process, you shouldn’t need to direct the user through the authorization process each time they access the app.


Hi David,
Our app is part of a Windows native application instead of a web application. The only occasion web browser is involved is when logging in, we open a pop-up browser window that navigates to the Hubspot oauth sign-in page. After that, we capture the access token and refresh token and close the browser pop-up. When the user wants to logout Hubspot, our current approach is to clear the tokens we cached in the app, open the browser pop-up again navigating to Hubspot portal and ask the user to logout Hubspot. This 2-step process for logout is cumbersome. Ideally, the user only needs to click the “logout” button in our app and it will programmatically logout Hubspot without opening a pop-up.
Please let me know if you have further questions. Hopefully Hubspot can add this support.


@dadams, just wanted to check back again, did Hubspot provide or consider providing a way for 3rd party integrations to programmatically logout Hubspot? Our integration uses oauth to login, after that hubspot session is live. Even after users logout our UI and we clear all access tokens in our domain, hubspot session is still live and access token are still cached under hubspot domain. If the user navigate to www.hubspot.com on their browser, they find the are still logged into hubspot, which is surprising to them.

If there is any API or a special URL we can redirect user to that will log out the user fully, that’d be a big security plus. Thanks!


I think I found the programmatic way to sign out. Navigating to https://app.hubspot.com/login-api/v1/logout/all from the integration app, it will sign out all hubspot sessions.


@dadams, https://app.hubspot.com/login-api/v1/logout/all API stopped working today. Was this communicated somewhere that I missed? This is breaking our app. Could you help provide alternatives? Thanks!