optional_scope=null on initial app connect

Hi folks,

I’m noticing a problem on initial OAuth app connect, i.e. when the user is not logged-in into Hubspot in the same browser - the problem is that after they log-in into Hubspot they are redirected to our app’s connection URL but it contains optional_scope=null which leads to an error in the UI.
Here are the detailed steps to reproduce:
1) Open an incognito browser and follow your app connection URL
2) Since you are not logged-in into your Hubspot account in this browser you will be prompted to do so. Select “Sign in to your HubSpot account” then log-in via Google. You will receive code in your email inbox after which you will land on the App connection screen.

3) Notice the URL at this point - it contains the additional optional_scope=null parameter.
4) Select your account from the list. You will get an error page with this message:

Couldn’t complete the connection. An invalid scope name was provided. Please contact the app developer.

This seems to happen because of the null value of the optional_scope parameter. However, our app is not including this parameter so it seems like something Hubspot does by itself (a bug, maybe?). If you remove this parameter and visit the page again, your will be able to connect your app.

This seems to happen only if you first go through the hubspot sign-in flow (no issues if you are already singed in). So maybe the problem is with the redirect between the Google login and going back into the oauth flow for app connect. Any clue how to deal with this?

We observed an issue similar to yours. During the initial connection to HubSpot, it adds optional_scope=null and state=null parameters, which result in the following error:

‘Couldn’t complete the connection. An invalid scope name was provided. Please contact the app developer.’

We seeing this issue too!