OAuth Authorization Failure for Users without Active Hubspot Session

Issue Description:

Currently, when a user does not have an active Hubspot session in the browser (either because the user logged out or has not logged in before) and attempts to authorize our OAuth client, it results in an ‘invalid scope name’ error. This behavior is not intended, as the authorization with the OAuth client should not fail based on the user’s session status (existence or non-existence).

Request for Validation and Workaround:

I would like to request validation of this issue, as it seems to be a valid concern. The OAuth client’s authorization process should not be impacted by the user’s session status. If it is confirmed as an issue, I would appreciate guidance on how to work around it.

Enhancement Proposal:

To enhance the user experience, I suggest redirecting all errors, including the ‘invalid scope name’ error, back to the OAuth client’s redirect URL. This way, the client can provide the user with appropriate suggestions on the steps to be taken, regardless of the authorization outcome

Hi @DanhNguyen22 :waving_hand: Thank you very much for taking the time to detail out the issue, your request for clarification, and your suggested improvements.

The most direct way to get this logged and investigated is to file a formal support ticket from your portal that has support access. If you only have a developer account or a free hub, please let me know here and we’ll look at our options.

Please check my understanding:

When a User is Not Logged In: The “invalid scope name” error appears during the OAuth client’s authorization process
Expected Behaviour: Even if the user is not logged in, the OAuth process should redirect to HubSpot’s login page, and after successful authentication, should proceed with the proper authorization

Next steps:

  • Verify the OAuth request, particularly the scopes you are requesting. There might be an underlying issue with the scopes themselves that gets exposed only in this specific scenario
  • Temporary fix — guide users to log in to HubSpot before attempting to authorize with your OAuth client

Your suggestion to redirect all errors, including the “invalid scope name” error, back to the OAuth client’s redirect URL makes sense and would likely enhance the users’ experience. I’m going to try to track down the PM or team for OAuth and share your suggestions and feedback there as well.

Thank you! — Jaycee

Thank you for your swift response!

Yes, I currently have a dev account and a free hub for testing the OAuth client integration.

For your understanding:

“Expected Behaviour: Even if the user is not logged in, the OAuth process should redirect to HubSpot’s login page, and after successful authentication, should proceed with the proper authorization”

=> Actually, the OAuth process does redirect users to the login page, regardless of whether they have an active session on HubSpot. However, right after the user completes authentication, we encounter the ‘invalid scope’ issue above (In case the user does not have an active session in HubSpot)

I can reliably reproduce this issue (100%) by following the steps I’ve described.

I strongly believe that the problem is not related to the OAuth request or scopes. Because when a user is already logged in to HubSpot, there are no issues with OAuth client authorization. The root cause may be something different.

Please inform me if the development team or the responsible individuals encounter difficulty reproducing the issue.

Best regards,

Hello @Jaycee_Lewis , I hope you’ve had a chance to read my message. Could you provide any updates on the status of this issue? Besides, our company (Credify) has Bee Next as our investor.