Skip to content

User Authentication

twistedstream edited this page Oct 17, 2014 · 2 revisions

Many RadBus API endpoints require requests to be user authenticated since they need access to a user's personal schedule configuration. Rather than store user credentials internally, RadBus uses OAuth2 Authorization to identify the user and then is able to look up their RadBus data using a hash of their email address as an identifier.

Creating an OAuth2 Token

To use a request that requires authentication you must pass an Authorization HTTP header with a Bearer token obtained by a supported OAuth2 provider. Currently the RadBus API only supports OAuth2 tokens generated from Google ID's, which you can learn more about here.

That site will guide you in generating a token programmatically for the type of client app you're creating (mobile, web). However, if all you want to do is manually generate a token for development purposes or just to exercise the API directly (using a tool like cURL or Postman), then check out the Generating an OAuth2 Token section of the Development Environment wiki page.

When obtaining your OAuth2 token from Google, you will be required to provide three pieces of information that link the token to the RadBus API and the type of access the API requires on behalf of the user:

  • RadBus Web API's Google Client ID
  • RadBus Web API's Google Client Secret
  • OAuth2 Scopes value

To obtain these values, the client should call the OAuth2 resource.

User Authentication Failure Responses

Any endpoint that requires user authentication can produce the following errors:

401 Unauthorized

  • No Authorization request header was passed.
  • The OAuth2 token in the Authorization request header was created using the wrong scopes value. See the Creating an OAuth2 Token section above for information on how to use the right scopes value.
  • The OAuth2 token in the Authorization request header has expired. When this happens, the client should generate a new token and call the same RadBus API endpoint again.