Link a user to an account on an external service
const url = 'https://gitea.example.com/api/v1/admin/users/example/external-logins';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"external_id":"example","login_source_id":1,"provider":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gitea.example.com/api/v1/admin/users/example/external-logins \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "external_id": "example", "login_source_id": 1, "provider": "example" }'Gitea Enterprise only. This endpoint is not part of the community edition.
Migrations attribute issues, pull requests and comments to the local user linked to the original author. Linking again an account that is already linked to the same user succeeds. A login_source_id of 0 means the account does not belong to an authentication source; the external_id must then be unique among all providers using 0, otherwise 409 is returned. A non-zero login_source_id must be an existing authentication source.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Username of the user to link
Request Bodyrequired
Section titled “Request Bodyrequired”LinkExternalLoginOption options to link a user to an account on an external service, so that content migrated from that service is attributed to the user
object
The user’s ID on the external service
The authentication source the link belongs to, 0 when there is none. A non-zero value must be an existing authentication source.
The name of the external service, e.g. “bitbucketserver”. Migrations look users up by the service name of the migration source.
Examplegenerated
{ "external_id": "example", "login_source_id": 1, "provider": "example"}Responses
Section titled “Responses”APIEmpty is an empty response
APIForbiddenError is a forbidden error response
Headers
Section titled “Headers”APINotFound is a not found empty response
The external account is already linked to another user
APIValidationError is error format response related to input validation