Home
/
Reference
/
REST API
/
Authorization

Authorization

Check authorization

Code samples

# Example request using curl
curl -X POST http://coder-server:8080/api/v2/authcheck \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

POST /authcheck

Body parameter

{
	"checks": {
		"property1": {
			"action": "create",
			"object": {
				"any_org": true,
				"organization_id": "string",
				"owner_id": "string",
				"resource_id": "string",
				"resource_type": "*"
			}
		},
		"property2": {
			"action": "create",
			"object": {
				"any_org": true,
				"organization_id": "string",
				"owner_id": "string",
				"resource_id": "string",
				"resource_type": "*"
			}
		}
	}
}

Parameters

NameInTypeRequiredDescription
bodybodycodersdk.AuthorizationRequesttrueAuthorization request

Example responses

200 Response

{
	"property1": true,
	"property2": true
}

Responses

StatusMeaningDescriptionSchema
200OKOKcodersdk.AuthorizationResponse

To perform this operation, you must be authenticated. Learn more.

Log in user

Code samples

# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users/login \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

POST /users/login

Body parameter

{
	"email": "[email protected]",
	"password": "string"
}

Parameters

NameInTypeRequiredDescription
bodybodycodersdk.LoginWithPasswordRequesttrueLogin request

Example responses

201 Response

{
	"session_token": "string"
}

Responses

StatusMeaningDescriptionSchema
201CreatedCreatedcodersdk.LoginWithPasswordResponse

Change password with a one-time passcode

Code samples

# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users/otp/change-password \
  -H 'Content-Type: application/json'

POST /users/otp/change-password

Body parameter

{
	"email": "[email protected]",
	"one_time_passcode": "string",
	"password": "string"
}

Parameters

NameInTypeRequiredDescription
bodybodycodersdk.ChangePasswordWithOneTimePasscodeRequesttrueChange password request

Responses

StatusMeaningDescriptionSchema
204No ContentNo Content

Request one-time passcode

Code samples

# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users/otp/request \
  -H 'Content-Type: application/json'

POST /users/otp/request

Body parameter

{
	"email": "[email protected]"
}

Parameters

NameInTypeRequiredDescription
bodybodycodersdk.RequestOneTimePasscodeRequesttrueOne-time passcode request

Responses

StatusMeaningDescriptionSchema
204No ContentNo Content

Convert user from password to oauth authentication

Code samples

# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users/{user}/convert-login \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Coder-Session-Token: API_KEY'

POST /users/{user}/convert-login

Body parameter

{
	"password": "string",
	"to_type": ""
}

Parameters

NameInTypeRequiredDescription
userpathstringtrueUser ID, name, or me
bodybodycodersdk.ConvertLoginRequesttrueConvert request

Example responses

201 Response

{
	"expires_at": "2019-08-24T14:15:22Z",
	"state_string": "string",
	"to_type": "",
	"user_id": "a169451c-8525-4352-b8ca-070dd449a1a5"
}

Responses

StatusMeaningDescriptionSchema
201CreatedCreatedcodersdk.OAuthConversionResponse

To perform this operation, you must be authenticated. Learn more.

See an opportunity to improve our docs? Make an edit.