How to give a GitLab access token to an external application?

Hello,

We use GitLab SaaS to manage code. Our web app would like to use the GItlab API to add one of our public keys to a user’s GitLab keychain. To edit a user with an API call we need that user’s access token. What API call should our web application use to do the following:

  • Open a new window where the user can input their username and password authorizing our app to access GitLab
  • Provide our app with an access token that the web app can use to temporarily impersonate them.

This is the closes I’ve come so far to figuring this out, but opening the URL in our service does nothing. We would greatly appreciate any explanations or example code.

Thanks so much for your help!