Complete a GitHub link using a code+state pair
POST/api/v1/auth/link-github
Finalize a GitHub OAuth link for the authenticated user.
Validates the state token against the state cookie, exchanges the code with GitHub, and stores the resulting OAuthConnection.
- 400 if the state is invalid/expired or if the GitHub account is already linked to a different AISafe user.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 409
- 422
- 429
- 500
Successful Response
Bad request — malformed input or failed validation.
Missing, expired, or invalid credentials.
Authenticated but not authorized for this resource. Note: cross-organization reads return 404, not 403.
Resource not found, or hidden for tenant-enumeration safety (the caller lacks permission to know whether the resource exists).
Conflict — the current resource state does not allow this operation (e.g. assessment already started, email already in use).
Semantic validation failure — request shape was valid but contents were not.
Too many requests — rate limited. Retry after the window resets.
Internal server error — unexpected failure.