Connect two oauth (Google & Instagram) under the same user

Hi- I am trying to link both Google & Instagram accounts under the same User data via their respective oauth process.

The current workflow I am envisioning is:

  1. Log in/signup with Google oauth
  2. Link the Instagram oauth to the same user in #1

Does anyone know how to set up this workflow?


Side question: When I try to just log into the app with Instagram oauth (not involving the Google at all), there is no new user created under the “User” dataType. Anyone knows how to fix this bug?

Thanks!

You will need to handle, at least, one manually. [Showcase] Manual OAuth2 Token Integration

1 Like

Thanks, Jici! I’m following the steps to manually set up my Instagram Graph API, but I’m getting this state error (even though the url did also return with the authorization code):

{“statusCode”:400,“body”:{“status”:“ERROR”,“message”:“Missing state from oauth provider”}}

and when i added the state:

{“statusCode”:400,“body”:{“status”:“ERROR”,“message”:“Invalid state from oauth provider”}}


Current workflow:



It worked! I forgot to change my redirect uri

1 Like

Hey Jici- thanks for the help.

One follow-up question. I want to bulk update users’ social media data in the backend, but the Google token would expire after ~15 min (via the user-agent method).

Do you know if there is a way to maintain the authorization even when the user is offline?

for google you need to add access_type=offline to your authorization url. This will return a refresh token. You need to validate the access_token is expired before any request to Google API for this user. If expired, get a new access token with the refresh request process.

thanks! what’s the refresh request process? Is that something i need to set up separate from the oauth and data request?

You need to do a request to the token endpoint with grant_type=refresh_token&refresh_token=[settherefreshtokenoftheuserhere]

You need to keep your client id and secret for this request too.