APIs & Integrations

kbolaysmarterhq
Member

OAuth 2.0 server response malformed url

I am developing an app w/ OAuth using your documentation at https://developers.hubspot.com/docs/methods/oauth2/oauth2-quickstart

My redirect uri looks like https://domain.io/#/path1/path2/path3, and after the user grants permission to my application the redirect containing the oauth code places the query string in the path of my redirect uri. Looking like the following: 
https://domain.io/?code=codeValue#/path1/path2/path3. 

Obviously I would expect the query string to be after the path. Any guidance would be appreciated.

0 Upvotes
1 Reply 1
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

OAuth 2.0 server response malformed url

Hey @kbolaysmarterhq ,

 

The issue here is that your path is appearing in the URL fragment (i.e. #/path1/path2/path3). The fragment appears at the end of a URL, which is why it's appearing after the query parameters included for the OAuth process (see here).

 

I'm not particularly familiar with how to use the design pattern you've mentioned with the Authoriation code flow you've listed, but I think the following auth docs might be helpful: https://www.oauth.com/oauth2-servers/single-page-apps/

0 Upvotes