Overview

OAuth Authentication

We use OAuth 2.0 to secure our endpoints, so you'll need to talk with Pushpay (Church Community Builder) to get an application created.

To request access, please fill out the API access request form.

API Base URL

All API calls must be made against:

https://api.ccbchurch.com

Do not call https://[subdomain].ccbchurch.com directly.

Authentication Overview

The mechanism offered to vendors and churches for authorizing access to a church's data is the three-legged OAuth flow. Two auth types are available:

Auth TypePurpose
System AuthAuthorizes the vendor to access an entire church's data
Identity AuthAuthorizes API requests on behalf of an individual within the church

System Auth

This is the required first step to gain access to a church's data. A Master Administrator, or someone with permission to edit system-wide settings, must authorize your application before you can access that church's data.

Authorization URLhttps://oauth.ccbchurch.com/oauth/authorize
Token URLhttps://api.ccbchurch.com/oauth/token
(set the Accept header to application/vnd.ccbchurch.v2+json)

Sandbox Environment

For "sandbox" ChMS sites, use:

APIhttps://api-beta.ccbchurch.com
Auth serverhttps://beta-oauth.ccbchurch.com/

Query String Parameters

ParameterRequired?Description
subdomainOptionalBypasses the church's subdomain-entry step in the flow
client_idRequiredOAuth client ID provided by Pushpay
response_typeRequiredMust always equal code
stateOptionalUnique identifier to protect against CSRF (recommended)
scopeOptionalSpace-separated list of scopes your app can access. Must be a subset of the scopes granted when your OAuth application was created. Defaults to all granted scopes if omitted
redirect_uriRequiredMust exactly match the redirect URI registered with Pushpay for this OAuth application

Steps to Get an Access Token

  1. Redirect the user to the Authorization URL with the required parameters.
  2. The Master Administrator (or an admin with system-wide settings access) will:
    • Provide the subdomain, if it wasn't included in the original redirect
    • Log in to their Pushpay site, if not already logged in
    • Review the requested scopes and authorize the vendor to use them
  3. Pushpay redirects back to your redirect_uri with an authorization code.
  4. POST to the Token URL with:
    • grant_type=authorization_code
    • code — the value returned in the previous step
  5. Pushpay returns an access token (see the token model reference).
  6. Use the access token as a Bearer token in the Authorization header for all subsequent API requests.

Identity Auth

This flow is similar to System Auth, but skips the authorization step. Identity Auth requires that the church has already completed System Auth to authorize the vendor.

Use this flow to make API requests on behalf of a specific individual — the permissions of that authenticated person are applied to each request. This is what powers a "Login with Pushpay" experience in your application.

Authorization URLhttps://oauth.ccbchurch.com/oauth/authorize
Token URLhttps://api.ccbchurch.com/oauth/token

Query String Parameters

ParameterRequired?Description
resource_owner_authRequiredSet to trigger Identity Auth instead of System Auth
(all System Auth parameters)All other parameters from the System Auth flow also apply here


Refreshing Tokens

Access Tokens expire every two (2) hours. You can use the refresh token, provided to you in the response when you first authorize and request the initial token.

{
  "access_token": "{access token}",
  "token_type": "bearer",
  "expires_in": 7200,
  "scope": "{scopes}",
  "refresh_token": "{refresh token}"
}

To refresh your token, POST to the Token URL with:

  • grant_type=refresh_token
  • refresh_token= the refresh token value returned from the previous token response

For more information on refreshing tokens, please see this article:

https://www.oauth.com/oauth2-servers/access-tokens/refreshing-access-tokens/


Additional Resources


Did this page help you?