https://linen.dev logo
How to handle re-authentication without creating d...
# 🖥│support-forum
s
Is there a way to re-authenticate an existing connected_account without creating a duplicate? Looking for "upsert" behavior in initiate()
u
Hey @schumi, you can use [this](https://docs.composio.dev/rest-api/connected-accounts/post-connected-accounts-by-nanoid-refresh) endpoint to refresh the connected account's auth. Let me know if this works for you.
s
For the refresh method, your TypeScript SDK doesn't support passing redirect_url?
As i understand, calling refresh will update the connected_account status to INITIATED, right?
If a user does not have sufficient Gmail permissions and we call the refresh method to generate a redirect URL, but the user ultimately does not take any further action, will the account status eventually become EXPIRED?
u
"As i understand, calling refresh will update the connected_account status to INITIATED, right?" — yes, you'll need to complete the auth flow to refresh the connected account which will set the status to ACTIVE. Also, I've escalated the
redirect_url
feature for ts SDK and we'll be working on it.
yes
s
if the status eventually become EXPIRED, we lose all of the user's existing permissions
do you have a recommended way to handle this flow
u
We do not recommend refreshing the connected account frequently. You can pass a notice or always provide an option for users to refresh the connected account, as the auth flow is to be carried on the user's end.
s
What's the recommended auth flow for handling cases where users encounter insufficient permissions?
u
You'll need to refresh the connected account with an updated authConfig in this case, but you'll still need the user to complete the auth flow, so you need to update the user prior to refreshing.
s
So there’s no way to regenerate a redirect URL without changing the connected account status from ACTIVE, right?
The auth flow can be lengthy, which makes it challenging to ensure that users complete the entire flow
u
No, you cannot refresh a connected account without completing auth flow.
s
Got it
2 Views