Skip to main content

User Oauth Tokens Actions

https://api.losant.com/me/oauth-tokens

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

Get​

Returns the OAuth tokens for a user

Method And Url​

GET https://api.losant.com/me/oauth-tokens

Authentication​

A valid API access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, all.User.bounded, all.User.read, only.User, only.User.bounded, only.User.read, userOauthTokens.*, or userOauthTokens.get.

Request Query Parameters​

NameRequiredDescriptionDefaultExample
sortFieldNField to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdatednamesortField=name
sortDirectionNDirection to sort the results by. Accepted values are: asc, descascsortDirection=asc
pageNWhich page of results to return0page=0
perPageNHow many items to return per page100perPage=10
filterFieldNField to filter the results by. Blank or not provided means no filtering. Accepted values are: namefilterField=name
filterNFilter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering.filter=my*app

Request Headers​

NameRequiredDescriptionDefault
AuthorizationYThe token for authenticating the request, prepended with Bearer

Curl Example​

curl -H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
-X GET \
https://api.losant.com/me/oauth-tokens

Successful Responses​

CodeTypeDescription
200User OAuth TokensCollection of OAuth tokens

Error Responses​

CodeTypeDescription
400ErrorError if malformed request

Post​

Create a new OAuth token for a user

Method And Url​

POST https://api.losant.com/me/oauth-tokens

Authentication​

A valid API access token is required to access this endpoint. The token must include at least one of the following scopes: all.User, only.User, userOauthTokens.*, or userOauthTokens.post.

Request Headers​

NameRequiredDescriptionDefault
AuthorizationYThe token for authenticating the request, prepended with Bearer

Request Body​

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

{
"name": "My OAuth App",
"description": "OAuth application for automation",
"scope": [
"only.User.read",
"all.Application.read"
],
"defaultRole": "view",
"oauth": {
"client_id": "575ec8687ae143cd83dc4a97",
"redirect_uri": "https://example.com/callback",
"code_challenge": "E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM",
"code_challenge_method": "S256"
}
}

Curl Example​

curl -H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR_API_ACCESS_TOKEN' \
-X POST \
-d '{"name":"My OAuth App","description":"OAuth application for automation","scope":["only.User.read","all.Application.read"],"defaultRole":"view","oauth":{"client_id":"575ec8687ae143cd83dc4a97","redirect_uri":"https://example.com/callback","code_challenge":"E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM","code_challenge_method":"S256"}}' \
https://api.losant.com/me/oauth-tokens

Successful Responses​

CodeTypeDescription
201User OAuth TokenThe successfully created OAuth token

Error Responses​

CodeTypeDescription
400ErrorError if malformed request

Schemas​

Error​

Schema for errors returned by the API

Error Schema​

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

        Error Example​

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

        User OAuth Token​

        Schema for a single OAuth Token

        User OAuth Token Schema​

        • ▶
          {} 3 keys
          • "http://json-schema.org/draft-07/schema#"
          • "object"
          • ▶
            {} 12 keys
            • ▶
              {} 2 keys
              • ▶
                {} 2 keys
                • ▶
                  {} 3 keys
                  • ▶
                    {} 2 keys
                    • ▶
                      {} 2 keys
                      • ▶
                        {} 2 keys
                        • ▶
                          {} 2 keys
                          • ▶
                            {} 2 keys
                            • ▶
                              {} 3 keys
                              • ▶
                                {} 4 keys
                                • ▶
                                  {} 2 keys
                                  • ▶
                                    {} 2 keys

                                User OAuth Token Example​

                                • ▶
                                  {} 11 keys
                                  • "575ec7417ae143cd83dc4a95"
                                  • "575ec7417ae143cd83dc4a95"
                                  • "My OAuth App"
                                  • "OAuth application for automation"
                                  • "2016-06-13T04:00:00.000Z"
                                  • "2016-06-13T04:00:00.000Z"
                                  • ▶
                                    [] 2 items
                                    • "view"
                                    • [] 0 items
                                      • "active"
                                      • ▶
                                        {} 6 keys

                                      User OAuth Token Post​

                                      Schema for the body of an OAuth Token creation request

                                      User OAuth Token Post Schema​

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

                                                      User OAuth Token Post Example​

                                                      • ▶
                                                        {} 5 keys
                                                        • "My OAuth App"
                                                        • "OAuth application for automation"
                                                        • ▶
                                                          [] 2 items
                                                          • "view"
                                                          • ▶
                                                            {} 4 keys

                                                          User OAuth Tokens​

                                                          Schema for a collection of OAuth Tokens

                                                          User OAuth Tokens Schema​

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

                                                                            User OAuth Tokens Example​

                                                                            • ▶
                                                                              {} 7 keys
                                                                              • ▶
                                                                                [] 1 item
                                                                                • 1
                                                                                • 1
                                                                                • 1000
                                                                                • 0
                                                                                • "name"
                                                                                • "asc"

                                                                              Was this page helpful?


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