Difference between revisions of "Personal/Test OAuth Token Generation"

From Active911 Documentation Wiki
Jump to: navigation, search
(Setup)
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
These directions allow a user to generate a set of tokens for use with the [[Active911 Developer API]]
 +
 
Users can generate Oauth Tokens codes for personal use as long as they have [[Understanding permissions|Edit Agency]] permission for that agency.
 
Users can generate Oauth Tokens codes for personal use as long as they have [[Understanding permissions|Edit Agency]] permission for that agency.
  
 
This does not require pre-registration of a developer account.
 
This does not require pre-registration of a developer account.
  
You must use the Google OAuth2.0 Playground to generate an access token and a refresh token.
+
You must use the Active911 OAuth Generation page to generate an access token and a refresh token.
  
 
==Setup==
 
==Setup==
[[File:OAuth_Settings.jpg|left]]
+
#Go to https://console.active911.com/interface/dev/oauth_gen.php
#Go to https://developers.google.com/oauthplayground/
+
#Click the Gear in the top right corner to change the settings to point at our servers.
+
#*Change "OAuth endpoints" to "custom"
+
#*Change "Authorization endpoint" to "https://access-or.active911.com/interface/open_api/authorize_agency.php"
+
#*Change "Token endpoint" to "https://access-or.active911.com/interface/open_api/token.php"
+
#*Change "OAuth Client ID" to "self"
+
  
==Generating an authorization code==
+
==Generating a refresh token==
  
#In Step 1 of the Google OAuth webpage, enter the scope you want to apply to the tokens you are generating.  For more information on Scope, [[OAuth Scope|click here]]
+
#Select/deselect the scopes you want to apply to the tokens you are generating.  This is a space delimited list of one or more of [[OAuth Scopes|these scopes]]
#Click the "Authorize APIs" button.  You should be brought to a page which will allow you to select which Agency you want to generate the tokens for.
+
#Click the "Submit" button.  You should be brought to a page which will allow you to select which Agency you want to generate the tokens for.
 
#Select an Agency and click 'Submit'.  After selecting an agency, you will be prompted to confirm your authorization.   
 
#Select an Agency and click 'Submit'.  After selecting an agency, you will be prompted to confirm your authorization.   
 
#Click 'Yes'.   
 
#Click 'Yes'.   
  
#After confirming your authorization, you will be brought back to the OAuth2.0 Playground where the Authorization Code will be entered under Step 2 of the Google OAuth webpage for you.
+
After confirming your authorization, you will be brought back to the OAuth page where the Access Token and Refresh token will be shown
 +
 
 +
==Generating an access token from the refresh token==
 +
You may generate a new Access Token using your Personal Refresh Token at https://console.active911.com/interface/dev/api_access.php by using a POST request with a "refresh_token" parameter containing your refresh token value.
 +
 
 +
This will return a JSON object with:
 +
{
 +
  "access_token": "<The access token used to access the api>",
 +
  "expiration": "<timestamp of when the access token expires>"
 +
}
 +
 
 +
The Refresh Token is good for 1 year and is used to generate the Access token using the link above.
 +
 
 +
The Access token is good for 1 day.
  
 
==Accessing the API==
 
==Accessing the API==
#Exchange the Authorization Code for a Refresh Token and an Access Token in Step 2 of the Google OAuth webpage.
+
#Click "Use this in the api"
#Once you exchange your code for tokens, you can use Step 3 of the Google OAuth webpage to access our api.
+
#The Access token and Refresh token you generated should be autofilled
#Start with the url "https://access-or.active911.com/interface/open_api/api/" (Note the last backslash in required)
+
#Start with the url "https://access.active911.com/interface/open_api/api/"
#Other API calls can be found [[Open API methods|here]]
+
#Other API calls can be found [[Accessing the API|here]]

Latest revision as of 16:13, 19 November 2020

These directions allow a user to generate a set of tokens for use with the Active911 Developer API

Users can generate Oauth Tokens codes for personal use as long as they have Edit Agency permission for that agency.

This does not require pre-registration of a developer account.

You must use the Active911 OAuth Generation page to generate an access token and a refresh token.

Setup

  1. Go to https://console.active911.com/interface/dev/oauth_gen.php

Generating a refresh token

  1. Select/deselect the scopes you want to apply to the tokens you are generating. This is a space delimited list of one or more of these scopes
  2. Click the "Submit" button. You should be brought to a page which will allow you to select which Agency you want to generate the tokens for.
  3. Select an Agency and click 'Submit'. After selecting an agency, you will be prompted to confirm your authorization.
  4. Click 'Yes'.

After confirming your authorization, you will be brought back to the OAuth page where the Access Token and Refresh token will be shown

Generating an access token from the refresh token

You may generate a new Access Token using your Personal Refresh Token at https://console.active911.com/interface/dev/api_access.php by using a POST request with a "refresh_token" parameter containing your refresh token value.

This will return a JSON object with:

{
 "access_token": "<The access token used to access the api>", 
 "expiration": "<timestamp of when the access token expires>"
}

The Refresh Token is good for 1 year and is used to generate the Access token using the link above.

The Access token is good for 1 day.

Accessing the API

  1. Click "Use this in the api"
  2. The Access token and Refresh token you generated should be autofilled
  3. Start with the url "https://access.active911.com/interface/open_api/api/"
  4. Other API calls can be found here