Make one-click OAuth external service connection possible on the backend
Created by: artemruts
Description
To make one-click OAuth code host connections work we need to create a new record in external_services
table when the backend captures the token from the auth provider.
I think it may make sense to create a new ./api/[github|gitlab|*]/<some new name>
endpoint where I can send GET
requests from the client.
The logic behind the new endpoint will be responsible for handling the OAuth dance (we can probably reuse exiting providers) and creating a new record in external_services
table.
external_services
table will need to contain the config
field with the correct JSON configuration for the given provider, where the token
field is the captured OAuth token.
GitHub config
example:
{
"url": "https://github.com",
"token": "<captured token>",
"orgs": []
}
#18067 (closed))
Acceptance Criteria (this + UITo add a new OAuth code host connection:
- On the client-side I can send a
GET
request to./api/[github|gitlab|*]/<some new name>
endpoint and specify theredirect
url with the query parameter - Once the backend OAuth logic completes client gets redirected to the url specified in
the redirect
query param
Once backend and frontend parts are complete the entire flow will look similar to the Account security
page: