DAE API Documentation
  • Introduction
  • Authentication
    • Authorizing Requests
  • Hazards
    • What are Global Active Hazards?
    • Requesting Hazard Types
    • Requesting Hazard Severities
    • Requesting Hazard Categories
    • Requesting Active Hazards
      • Requesting Active Hazards of a Specific Category
      • Requesting Active Hazards of a Specific Severity
    • Hazard’s Smart Alert Geography
  • Products
    • What are Products?
    • Requesting Product Types
    • Requesting a Hazard’s Products
    • Requesting a Product
Powered by GitBook
On this page
  • Authorization API
  • Get accessToken and refreshToken

Was this helpful?

  1. Authentication

Authorizing Requests

In most cases, when sending requests to the DaaS services, the request includes a header that contains an authorization code. The authorization code is acquired by sending a request to DAE’s DaaS token service.

Authorization API

URL

HTTP Verb

Functionality

/authorize

POST

Login with posting credentials to get access and refresh JSON Web Tokens

Get accessToken and refreshToken

POST https://api.disasteraware.com/authorize

Login with posting credentials to get access and refresh JSON Web Tokens

Request Body

Name
Type
Description

User credential

object

User credential.

{
    "accessToken":"access.token.will.be.here",
    "refreshToken":"refresh.token.will.be.here"
}
Authentication failed.
curl --location --request POST \
  'https://api.disasteraware.com/authorize' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "username":"your_username", 
    "password":"your_password"
  }'
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;

class Main {

	public static void main(String[] args) throws IOException {
		URL url = new URL("https://api.disasteraware.com/authorize");
		HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
		httpConn.setRequestMethod("POST");

		httpConn.setRequestProperty("Content-Type", "application/json");

		httpConn.setDoOutput(true);
		OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
		writer.write("{ \"username\":\"your_username\", \"password\":\"your_password\" }");
		writer.flush();
		writer.close();
		httpConn.getOutputStream().close();

		InputStream responseStream = httpConn.getResponseCode() / 100 == 2
				? httpConn.getInputStream()
				: httpConn.getErrorStream();
		Scanner s = new Scanner(responseStream).useDelimiter("\\A");
		String response = s.hasNext() ? s.next() : "";
		System.out.println(response);
	}
}
var fetch = require('node-fetch');

fetch('https://api.disasteraware.com/authorize', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({ "username":"your_username", "password":"your_password" })
});
<?php
include('vendor/rmccue/requests/library/Requests.php');
Requests::register_autoloader();
$headers = array(
    'Content-Type' => 'application/json'
);
$data = '{ "username":"your_username", "password":"your_password" }';
$response = Requests::post('https://api.disasteraware.com/authorize', $headers, $data);
import requests

headers = {
    'Content-Type': 'application/json',
}

data = '{ "username":"your_username", "password":"your_password" }'

response = requests.post('https://api.disasteraware.com/authorize', headers=headers, data=data)

Please use the provided credentials to complete this request. The response will include a JSON Web Token (JWT) that you will send with the Authorization request header in the following format:

{
    "Authorization": "Bearer <insert-json-web-token>"
}
PreviousIntroductionNextWhat are Global Active Hazards?

Last updated 3 years ago

Was this helpful?

For more information about JWT please visit

jwt.io