Account linking from regular web app

I want to implement user-initiated account linking as explained here. On a configuration page, the authenticated user will be able to click on a Link another account button, authenticate through another connection then be redirected back to the application that will call the /api/v2/users/{id}/identities endpoint.
The application is an Express app and I found this example which is totally outdated and doesn’t run. I cannot figure how to adapt it to a newer version of express-openid-connect.
Can somebody help me understand how to set up my Express app so I can retrieve a secondary JWT for a user, while keeping the original access token to call the management API?
Thanks in advance for any advice!