i tried to integrate hubspot with my app , i used OAuth2.0 , while trying to authorize for first time im geting this available apps to connect ,selecting one took me to a page with connect app /cancel option ,if i click “connect App” im getting the code in my redirect url as expected , but when i do the integration once again,before clicking the “connect app” button the app is redirecting the code without me granting access,(i.e just choosing the available app link,redirection happens).
Hey @ldandelion
Why would you do it again? What happens when you disconnect the app and go through the auth process again?
@JZhao , what do you think ![]()
“Why would you do it again?” : we had to multiple integrations if needed, to do so we had to authorize again.
“What happens when you disconnect the app and go through the auth process again?” : it asks for consent for the first time , afterwards it is automatically sending auth code to redireted url.
@MichaelC how would you deal with this?
Im not sure that you are authenticating correctly.
This is how it should work:
1. You send a request with your client id, scopes, redirect uri and so and - you have done this part - check!
2. You will recieve an authentication code (showing as ?code=xxx in your adress bar) - check!
This code is only valid during this specific request - one time only - can not be reused - its only purpose is to use the code to send it to recieve an access token.
3. You send code you reiceved in step 2 - and you will get back an authentication token AND a refresh token - save these in your database.
4. Your authentication token is valid for a limited amount of time - in order to get a new one you can either go back to step 1 above - or request a new token (without user having to sign in) with the refresh token.
Are you used to working with oauth2 since before? Else I would advice you to read up on everything here: