跳转到内容
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!
Support

Link a user to an account on an external service

POST
/admin/users/{username}/external-logins
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.

username
required
string

Username of the user to link

Media typeapplication/json

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
external_id
required

The user’s ID on the external service

string
login_source_id

The authentication source the link belongs to, 0 when there is none. A non-zero value must be an existing authentication source.

integer format: int64
provider
required

The name of the external service, e.g. “bitbucketserver”. Migrations look users up by the service name of the migration source.

string
Examplegenerated
{
"external_id": "example",
"login_source_id": 1,
"provider": "example"
}

APIEmpty is an empty response

APIForbiddenError is a forbidden error response

message
string
url
string

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

message
string
url
string