Skip to main content

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

CodeTypeDescription
200Authenticated DeviceSuccessful authentication. The included api access token by default has the scope 'all.Device'.

Error Responses

CodeTypeDescription
400ErrorError if malformed request
401ErrorUnauthorized 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": "email@example.com",
"password": "this is the password"
}

Curl Example

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

Successful Responses

CodeTypeDescription
200Authenticated UserSuccessful authentication. The included api access token has the scope 'all.User'.

Error Responses

CodeTypeDescription
400ErrorError if malformed request
401ErrorUnauthorized 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

CodeTypeDescription
200Authenticated UserSuccessful authentication. The included api access token has the scope 'all.User'.

Error Responses

CodeTypeDescription
400ErrorError if malformed request
401ErrorUnauthorized 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": "example.com"
}

Curl Example

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

Successful Responses

CodeTypeDescription
200Authenticated UserSuccessful authentication. The included api access token has the scope 'all.User'.

Error Responses

CodeTypeDescription
400ErrorError if malformed request
401ErrorUnauthorized 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

NameRequiredDescriptionDefaultExample
emailYThe email address associated with the user loginemail=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

CodeTypeDescription
200SSO RequestSuccessful finding SSO for domain. Returns SSO request URL and type.
204undefinedNo domain associated with an SSO configuration

Error Responses

CodeTypeDescription
400ErrorError if malformed request

Schemas

Authenticated Device

Schema for the successful response when authenticating a Device

Authenticated Device Schema

  • {} 4 keys
    • "http://json-schema.org/draft-07/schema#"
    • "object"
    • {} 8 keys
      • {} 2 keys
        • {} 2 keys
          • {} 2 keys
            • {} 2 keys
              • {} 2 keys
                • {} 1 key
                  • {} 2 keys
                    • {} 2 keys
                    • [] 4 items

                    Authenticated Device Example

                    • {} 8 keys
                      • "575ec8687ae143cd83dc4a97"
                      • "575ecf887ae143cd83dc4aa2"
                      • "standalone"
                      • "token_to_use_for_authenticating_subsequent_requests"
                      • "organization"
                      • "whitelist"
                      • [] 1 item
                        • [] 1 item

                        Authenticated User

                        Schema for the successful response when authenticating a User

                        Authenticated User Schema

                        • {} 4 keys
                          • "http://json-schema.org/draft-07/schema#"
                          • "object"
                          • {} 4 keys
                            • {} 2 keys
                              • {} 2 keys
                                • {} 1 key
                                  • {} 2 keys
                                  • [] 2 items

                                  Authenticated User Example

                                  • {} 2 keys
                                    • "575ed70c7ae143cd83dc4aa9"
                                    • "token_to_use_for_authenticating_subsequent_requests"

                                  Device Credentials

                                  Schema for the body of a device authentication request

                                  Device Credentials Schema

                                  • {} 5 keys
                                    • "http://json-schema.org/draft-07/schema#"
                                    • "object"
                                    • {} 5 keys
                                      • {} 2 keys
                                        • {} 1 key
                                          • {} 1 key
                                            • {} 2 keys
                                              • {} 3 keys
                                              • [] 1 item
                                                • false

                                              Device Credentials Example

                                              • {} 3 keys
                                                • "575ecf887ae143cd83dc4aa2"
                                                • "this_would_be_the_key"
                                                • "this_would_be_the_secret"

                                              Error

                                              Schema for errors returned by the API

                                              Error Schema

                                              • {} 3 keys
                                                • "http://json-schema.org/draft-07/schema#"
                                                • "object"
                                                • {} 2 keys
                                                  • {} 1 key
                                                    • {} 1 key

                                                  Error Example

                                                  • {} 2 keys
                                                    • "NotFound"
                                                    • "Application was not found"

                                                  Github Login

                                                  Schema for the body of a Github login request

                                                  Github Login Schema

                                                  • {} 5 keys
                                                    • "http://json-schema.org/draft-07/schema#"
                                                    • "object"
                                                    • {} 3 keys
                                                      • {} 3 keys
                                                        • {} 3 keys
                                                          • {} 2 keys
                                                          • [] 1 item
                                                            • false

                                                          Github Login Example

                                                          • {} 1 key
                                                            • "the github access token"

                                                          SAML Response

                                                          SAML Response body for login

                                                          SAML Response Schema

                                                          • {} 5 keys
                                                            • "http://json-schema.org/draft-07/schema#"
                                                            • "object"
                                                            • {} 4 keys
                                                              • {} 3 keys
                                                                • {} 3 keys
                                                                  • {} 3 keys
                                                                    • {} 2 keys
                                                                    • [] 2 items
                                                                      • false

                                                                    SAML Response Example

                                                                    • {} 2 keys
                                                                      • "PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoy..."
                                                                      • "example.com"

                                                                    SSO Request

                                                                    SSO Request built from the SP and IDP config

                                                                    SSO Request Schema

                                                                    • {} 4 keys
                                                                      • "http://json-schema.org/draft-07/schema#"
                                                                      • "object"
                                                                      • {} 2 keys
                                                                        • {} 2 keys
                                                                          • {} 2 keys
                                                                          • [] 2 items

                                                                          SSO Request Example

                                                                          • {} 2 keys
                                                                            • "SAML"
                                                                            • "http://localhost:8080/simplesaml/saml2/idp/SSOService.php?SAMLRequest=fZJdT8MgFIb%2..."

                                                                          User Credentials

                                                                          Schema for the body of a User authentication request

                                                                          User Credentials Schema

                                                                          • {} 5 keys
                                                                            • "http://json-schema.org/draft-07/schema#"
                                                                            • "object"
                                                                            • {} 5 keys
                                                                              • {} 3 keys
                                                                                • {} 3 keys
                                                                                  • {} 2 keys
                                                                                    • {} 3 keys
                                                                                      • {} 2 keys
                                                                                      • [] 2 items
                                                                                        • false

                                                                                      User Credentials Example

                                                                                      • {} 2 keys
                                                                                        • "email@example.com"
                                                                                        • "this is the password"

                                                                                      Was this page helpful?


                                                                                      Still looking for help? You can also search the Losant Forums or submit your question there.