How to Authenticate

Summary

This page describes how to authenticate against the various Temeda APIs.

Table of Contents

Introduction

Temeda uses two authentication strategies to grant third party access to our APIs;

  • Classic Auth
  • Modern Auth (OAuth 2.0)

The method you will use depends on how your account was created. If you are unsure as to which method to use, contact our Customer Support Team (customer.support@temeda.com).

Environment Code

Before we describe both methods in detail, you'll need to know your environment code. This code will be provided by Customer Support upon approval of your request. Attempting to use an environment code other than the one provided will result in a '401 Unauthorized' response when accessing an API. You will be required to provide your assigned code in the `EnvironmentCode` header with all requests. Please note that environment codes are case sensitive.

Requesting Access

Before you can submit a request to one of the APIs, you'll need to request access here. Once our Customer Support team approves your request, you will be provided with the necessary information to authenticate.

Classic Auth

With Classic Auth, you will be provided a static token & subscription key to use for all requests into Temedas APIs.

Information Required

To authenticate with Classic Auth, you'll need the following:

  • The API URL for your subscription.
  • Your designated environment code.
  • The Classic Auth token that identifies your account.
  • A subscription key.

Example

The following example demonstrates how to authenticate using Classic Auth with the Telemetry API. If successful, a JSON array of Assets will be returned.

  • API URL: https://temeda.azure-api.net/telemetry/assets
  • Token: dGVzdDp0Zkkklsl909898skdXN0MTIz
  • Environment Code: DEV
  • Subscription Key: 57b5cadfc7ba4c7bb4bc5cda9df48263
                    
GET https://temeda.azure-api.net/telemetry/assets
Content-Type: application/json
Authorization: dGVzdDp0Zkkklsl909898skdXN0MTIz
EnvironmentCode: DEV
Ocp-Apim-Subscription-Key: 57b5cadfc7ba4c7bb4bc5cda9df48263
                    
                  

Modern Auth (OAuth 2.0)

Modern Auth follows the OAuth 2.0 Implicit Grant standard as defined in section 4.2 in IETF RFC 6749. It is a two step process that requires you to obtain an access token via our Tokens API.

Information Required

The first step in accessing our APIs is to request an access token vial our Tokens API. To do that, you will need the following information:

  • Your account username & password.
  • Our standard Client ID: 1816204c-6690-4615-b7a5-c2227847ee08
  • Our standard Tokens API Endpoint: https://temedapassport.b2clogin.com/temedapassport.onmicrosoft.com/b2c_1a_signin_ropc/oauth2/v2.0/token

Once you obtain a token, you may use it until it expires (1 hour unless otherwise specified) to access the API you are subscribed to.

Example

                      
POST https://temedapassport.b2clogin.com/temedapassport.onmicrosoft.com/b2c_1a_signin_ropc/oauth2/v2.0/token
Content-Type: application/x-www-form-urlencoded

client_id=1816204c-6690-4615-b7a5-c2227847ee08&scope=openid 1816204c-6690-4615-b7a5-c2227847ee08 offline_access&username={{username}}&password={{password}}&grant_type=password&response_type=token id_token
                      
                    

A successful response will include a standard OAuth 2.0 Implicit Grant token response. The access_token is what should be used for data requests.

{
  "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Inl2ZVEtT...",
  "token_type": "Bearer",
  "expires_in": "3600",
  "refresh_token": "eyJraWQiOiJ5dmVRLU40MWdrTG4wZjduR1FkMmFpUUtiSGR6czZW...",
  "id_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Inl2ZVEtTjQxZ..."
}

You may now use the token to access the various APIs. The following example is the same as defined in the 'Classic Auth' section but uses the tokens defined above. Note that you will need to include 'Bearer' before the token in the Authorization header.

                    
GET https://temeda.azure-api.net/telemetry/assets
Content-Type: application/json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Inl2ZVEtT...
EnvironmentCode: DEV
Ocp-Apim-Subscription-Key: 57b5cadfc7ba4c7bb4bc5cda9df48263
                    
                  

Samples

You may download the following samples to test locally by right clicking and saving the file. Please note that you will need a pre-existing account before you can properly use these.