verida / data-connector-server

1 stars 2 forks source link

Pass new connection Id in redirected callback #105

Closed aurelticot closed 2 months ago

aurelticot commented 2 months ago

In the callback method, being executed when the Provider OAuth redirects back after a user logged-in and authorised the connection, the Data Connection Server creates the new connection and redirects to the application that initiated it in the first place.

https://github.com/verida/data-connector-server/blob/83b42d4002d43b68ffdf7694d4654b827f49096b/src/api/v1/base/controller.ts#L90-L92

It would be good to pass the newly created connection id with the redirect:

 // should try/catch the whole in case the `redirect` is not a valid URL
const redirectedUrl = new URL(req.session.redirect)
redirectedUrl.searchParams.append("connectionId", newConnectionRecordId)
res.redirect(redirectedUrl.toString())