The ShootProof API uses OAuth 2.0 to authorize users, providing access to our API. We use the authorization code grant type (commonly referred to as three-legged OAuth) with refresh tokens.
To help us streamline the signup process for users who don’t yet have a ShootProof studio account, see New Studio Signup.
To authorize access to the ShootProof API, you must include the following scope in your OAuth requests.
studio
The studio
scope may be combined with other API scopes if you are using the same authorization for our legacy API. See the developer documentation of our legacy API for more information.
Redirect your user to the following URL, using these query string parameters. We will present the user with a ShootProof login page. Once successfully logged in, the user will be prompted to grant (authorize) your app access to their ShootProof data, and then we will redirect the user to your redirect url with a code
query string parameter. You may then exchange this temporary code for an access token.
https://auth.shootproof.com/oauth2/authorization/new
response_type
response_type
with a value of code
.client_id
redirect_uri
scope
studio
scope.state
state
parameter in your request. This value is opaque to ShootProof; we simply include this value when redirecting the user back to your app. You can check its value to determine the validity of the request. In this way, it is useful to prevent cross-site request forgeries.oauth_signup
oauth_signup
parameter to streamline the ShootProof studio signup process for users new to ShootProof. See New Studio Signup for more information.https://auth.shootproof.com/oauth2/authorization/new
?response_type=code
&client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
&redirect_uri=https://example.com/redirect
&scope=studio
&state=9deafe2dfff0b0fabcbac628090fadd662ef0302
&oauth_signup=eyJzdHVkaW9OYW1lIjoiRG95bGUgU3R1ZGlvIiwiZmlyc3ROYW1lIjoiU2FtYW50aGEiLCJsYXN0TmFtZSI6IkRveWxlIiwicGhvbmUiOiIoNTU1KSA1OTgtMzQxMCIsImVtYWlsIjoic2FtQGV4YW1wbGUuY29tIn0=
Upon successful login or signup, ShootProof will redirect the user back to your app, using the given redirect_uri
and state
values:
https://example.com/redirect
?state=9deafe2dfff0b0fabcbac628090fadd662ef0302
&code=68a8bdc685c6d48fbd84870ebe4371cd7ffc6f58
You may then exchange the given code for an access token.
The ShootProof authorization service follows the guidelines in RFC 6749 § 4.1.2.1 for communicating authorization code request errors.
Once you have obtained an authorization code, you may exchange it for an access token. For this request, you MUST NOT redirect the user. This is a POST
request that is performed in the background from your secure server. The response of this request will give you an access token that you may then use to make authenticated requests using the API. Along with the access token, we will provide expiration information and a refresh token that may be used to get a new access token prior to expiration.
Access tokens last 2 weeks, though it is a good idea to refresh before the access token expires.
The access token and refresh token are sensitive pieces of information and MUST be treated just like a user’s password and other personal information. You MUST encrypt these values at rest.
https://auth.shootproof.com/oauth2/authorization/token
grant_type
grant_type
with a value of authorization_code
.client_id
code
redirect_uri
redirect_uri
MUST match the value used in the authorization code request step. We will not use this to redirect user; it is used as a verification check.scope
studio
scope.A successful access token response contains a JSON object with the following properties:
access_token
expires_in
3600
, the access token would expire in one hour from the time of the response.refresh_token
scope
token_type
token_type
will be bearer
. At this time, ShootProof supports only bearer token authentication.POST /oauth2/authorization/token HTTP/1.1
Accept: */*
Content-Length: 183
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host: auth.shootproof.com
grant_type=authorization_code&client_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&code=68a8bdc685c6d48fbd84870ebe4371cd7ffc6f58&redirect_uri=https%3A%2F%2Fexample.com%2Fredirect&scope=studio
HTTP/1.1 200 OK
Content-Length: 192
Content-Type: application/json
Date: Tue, 07 Nov 2017 23:33:24 GMT
{
"access_token": "f75dfe33f56c3793795dca279471f08bd96f2a86",
"expires_in": 1209600,
"refresh_token": "306e09d9bca79158b45db25c91c4d561ddb1b4b7",
"scope": "studio",
"token_type": "bearer"
}
The ShootProof access token service follows the guidelines in RFC 6749 § 5.2 for communicating access token request errors.
A refresh token is a long-lasting credential used to request additional access tokens. The refresh token request is very similar to the access token request.
https://auth.shootproof.com/oauth2/authorization/token
grant_type
grant_type
with a value of refresh_token
.refresh_token
scope
Response properties for a refresh token are identical to those for an access token. See the access token response properties for more information.
POST /oauth2/authorization/token HTTP/1.1
Accept: */*
Content-Length: 94
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host: auth.shootproof.com
grant_type=refresh_token&refresh_token=306e09d9bca79158b45db25c91c4d561ddb1b4b7&scope=studio
HTTP/1.1 200 OK
Content-Length: 192
Content-Type: application/json
Date: Wed, 08 Nov 2017 02:48:48 GMT
{
"access_token": "11ebcb3729dd6f71377bc760ed8ce591719e9234",
"expires_in": 1209600,
"refresh_token": "fe58a5e2480f968c1dbfae7c2719ce62d8da12d2",
"scope": "studio",
"token_type": "bearer"
}
The ShootProof refresh token service follows the guidelines in RFC 6749 § 5.2 for communicating refresh token request errors.