Skip to content

API reference

Sign-in methods API

Link another sign-in method to the signed-in user, or remove one.

On this page

POST /v1/auth/link/{provider}

Starts linking provider to the signed-in user. For a redirect provider the response carries the authorization URL and a browser-bound state cookie; for email a code and link are sent to the address and POST /v1/auth/email/verify (with this session) completes the link.

  • API key: not accepted (403 session_required).
  • Browser session: the vmyard_session cookie and the x-csrf-token header.
  • Who: The signed-in user.

Parameters

NameInTypeRequiredDescription
providerpathstringYesConfigured provider such as github, google, or email

Request body (application/json, LinkRequest)

FieldTypeRequiredDescription
emailstring | nullNoRequired for email, refused for other providers.
return_tostring | nullNoSame-origin UI path to open when the provider flow completes; invalid values become /.

Responses

StatusDescriptionBody
200Navigate to authorization_urlLinkStarted
202Email linking: a code was sent if the address can receive emailEmailStarted
401Not signed in, or the API key is malformed, expired, or revoked (unauthenticated, invalid_api_key).ProblemDetails
403csrf_invalid, session_required (API key), or recent_auth_requiredProblemDetails
404unsupported_providerProblemDetails
422Invalid request (invalid_request); field_errors names the fields.ProblemDetails
429Too many requests; wait for Retry-After.ProblemDetails
503Not available on this server.ProblemDetails
Request
curl -X POST "$VMYARD_API_URL/v1/auth/link/$PROVIDER" \
  -b "vmyard_session=$VMYARD_SESSION" \
  -H "x-csrf-token: $VMYARD_CSRF" \
  -H "Content-Type: application/json" \
  -d '{
  "return_to": "/"
}'
Response 200
{
  "authorization_url": "string"
}

Remove a sign-in method

DELETE /v1/auth/login-methods/{login_method_id}

Removes one of the signed-in user's sign-in methods. The last method cannot be removed. Existing sessions stay valid.

  • API key: not accepted (403 session_required).
  • Browser session: the vmyard_session cookie and the x-csrf-token header.
  • Who: The signed-in user.

Parameters

NameInTypeRequiredDescription
login_method_idpathstring (uuid)Yes

Responses

StatusDescriptionBody
204Removed—
401Not signed in, or the API key is malformed, expired, or revoked (unauthenticated, invalid_api_key).ProblemDetails
403csrf_invalid, session_required (API key), or recent_auth_requiredProblemDetails
404Not one of this user's methodsProblemDetails
409last_login_methodProblemDetails
Request
curl -X DELETE "$VMYARD_API_URL/v1/auth/login-methods/$LOGIN_METHOD_ID" \
  -b "vmyard_session=$VMYARD_SESSION" \
  -H "x-csrf-token: $VMYARD_CSRF"