Authorizing Requests
Authorization API
Get accessToken and refreshToken
Request Body
Name
Type
Description
{
"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);
}
}
Last updated
Was this helpful?