Auth Actions

https://api.losant.com/auth

Below are the various requests that can be performed against the Auth resource, as well as the expected parameters and the potential responses.

Authenticate Device

Authenticates a device using the provided credentials.

Method And Url

POST https://api.losant.com/auth/device

Authentication

No authentication is required for this endpoint.

Request Body

The body of the request should be serialized JSON that validates against the Device Credentials schema. For example, the following would be a valid body for this request:

{
  "deviceId": "575ecf887ae143cd83dc4aa2",
  "key": "this_would_be_the_key",
  "secret": "this_would_be_the_secret"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -X POST \
    -d '{"deviceId":"575ecf887ae143cd83dc4aa2","key":"this_would_be_the_key","secret":"this_would_be_the_secret"}' \
    https://api.losant.com/auth/device

Successful Responses

Code Type Description
200 Authenticated Device Successful authentication. The included api access token by default has the scope ’all.Device’.

Error Responses

Code Type Description
400 Error Error if malformed request
401 Error Unauthorized error if authentication fails

Authenticate User

Authenticates a user using the provided credentials.

Method And Url

POST https://api.losant.com/auth/user

Authentication

No authentication is required for this endpoint.

Request Body

The body of the request should be serialized JSON that validates against the User Credentials schema. For example, the following would be a valid body for this request:

{
  "email": "example@losant.com",
  "password": "this is the password"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -X POST \
    -d '{"email":"example@losant.com","password":"this is the password"}' \
    https://api.losant.com/auth/user

Successful Responses

Code Type Description
200 Authenticated User Successful authentication. The included api access token has the scope ’all.User’.

Error Responses

Code Type Description
400 Error Error if malformed request
401 Error Unauthorized error if authentication fails

Authenticate User Github

Authenticates a user via GitHub OAuth.

Method And Url

POST https://api.losant.com/auth/user/github

Authentication

No authentication is required for this endpoint.

Request Body

The body of the request should be serialized JSON that validates against the Github Login schema. For example, the following would be a valid body for this request:

{
  "accessToken": "the github access token"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -X POST \
    -d '{"accessToken":"the github access token"}' \
    https://api.losant.com/auth/user/github

Successful Responses

Code Type Description
200 Authenticated User Successful authentication. The included api access token has the scope ’all.User’.

Error Responses

Code Type Description
400 Error Error if malformed request
401 Error Unauthorized error if authentication fails

Authenticate User Saml

Authenticates a user via a SAML response.

Method And Url

POST https://api.losant.com/auth/user/saml

Authentication

No authentication is required for this endpoint.

Request Body

The body of the request should be serialized JSON that validates against the SAML Response schema. For example, the following would be a valid body for this request:

{
  "SAMLResponse": "PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoy...",
  "SAMLDomain": "losant.com"
}

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -X POST \
    -d '{"SAMLResponse":"PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoy...","SAMLDomain":"losant.com"}' \
    https://api.losant.com/auth/user/saml

Successful Responses

Code Type Description
200 Authenticated User Successful authentication. The included api access token has the scope ’all.User’.

Error Responses

Code Type Description
400 Error Error if malformed request
401 Error Unauthorized error if authentication fails

Sso Domain

Checks email domain for SSO configuration.

Method And Url

GET https://api.losant.com/auth/ssoDomain

Authentication

No authentication is required for this endpoint.

Request Query Parameters

Name Required Description Default Example
email Y The email address associated with the user login email=example@example.com

Curl Example

curl -H 'Content-Type: application/json' \
    -H 'Accept: application/json' \
    -X GET \
    https://api.losant.com/auth/ssoDomain?email=example%40example.com

Successful Responses

Code Type Description
200 SSO Request Successful finding SSO for domain. Returns SSO request URL and type.
204 undefined No domain associated with an SSO configuration

Error Responses

Code Type Description
400 Error Error if malformed request