Delib | Developer Docs
Knowledge Base
  • Delib
    • 👋Welcome
    • Our Products
  • Security Centre
    • Information Security
      • Service Level Agreement (SLA)
      • Disaster Recovery
      • Certifications
      • Information Security Downloadable Documents
    • Privacy and GDPR
      • How do Delib's products comply with the GDPR?
      • Delib Sub Processors
  • Citizen Space
    • Getting Started With Citizen Space
    • Deployment Requirements
      • How to set up a CNAME record for a custom domain name
      • Department structures
      • Users and permissions
      • Theming requirements
    • Security Configurations
      • Single Sign On (SSO)
        • Citizen Space Single Sign-on (SSO) - Linking Accounts
      • Two factor authentication (2FA)
      • Configurable password policy
      • Log in back-off
      • Security Notifications
      • Password reset date on export
      • Session Length
    • Integrations
      • How to integrate Citizen Space into existing website
    • Data API
      • API specification
      • Generating API keys
      • Basic Auth headers with Citizen Space
    • Public API
      • Public API v2.x guide
      • Version 2.4 reference
    • Webhooks
      • Creating and managing webhooks
  • Geospatial
    • Set-up process for existing customers
      • How to find your Ordnance Survey API key
      • Linking your Ordnance Survey account to Citizen Space
  • Integrations and Playbooks
    • Google Looker Studio
      • Google Looker Studio
      • Google Looker Studio Simple Activity Counts
    • Microsoft
      • PowerBI Dashboards
Powered by GitBook
On this page
  • What is Basic Authentication?
  • Practical example
  • Successful Request
  1. Citizen Space
  2. Data API

Basic Auth headers with Citizen Space

PreviousGenerating API keysNextPublic API

Last updated 11 months ago

What is Basic Authentication?

Basic Authentication is a common approach for authenticating to an API. Often it's the case where it's the base64 encoding of username and a password separated by a colon like so username:password.

Authenticating to an API in Citizen Space requires a request header is sent in the following format:

  • Key = 'Authorization'

  • Value = 'Basic' + base 64 encoding of a key and secret combined with a colon

Citizen Space makes it particularly easy to generate, manage, and use keys and you can see where you would collect this information from in the image below.

The below key is for demonstration purposes only and is not valid

Practical example

In this example we want to replicate a scenario in which a person in an organisation has asked to pull the latest site wide activity data from our Citizen Space into a third party analysis tool.

We can do that simply by amending the site URL:

List activities

GET /api/1/activities

Return a filtered list of all activities.

https://demo.citizenspace.com/api/1/activities

Without proper authentication this will return an error:

Successful Request

By encoding our key and secret and using Basic Authentication we can return the following:

List activities

GET /api/1/activities

Return a filtered list of all activities.

https://demo.citizenspace.com/api/1/activities

Headers

Key
Value

Authorization

Basic MjcxMzI3RENGQzVCNEU3NEE0MDI0NDkxMDM4QS4uLi46dkVta3NLQThSSEFYWXM2V01rWFpydmJ4UUthNjJyMnV6Q3h3ZndoWktXNmZ5Z0JDTWJZeHpEdlRVNy4uLi4=

Response

[
    {
        "uid": "67f18beb302944c9944e06521cf2224e",
        "title": "Smallville resident forum",
        "state": "open",
        "start_date": "2023-03-29T00:00:00",
        "end_date": "2027-03-26T00:00:00",
        "path": "demo/smallville-resident-forum"
    },
    {
        "uid": "ce620a61c70647ea90c8c63e6faefb3f",
        "title": "Mediumville resident forum",
        "state": "open",
        "start_date": "2023-03-29T00:00:00",
        "end_date": "2027-03-26T00:00:00",
        "path": "demo/mediumville-resident-forum"
    },
    {
        "uid": "4c55f1f0f9c34c248fbd6094770fe833",
        "title": "Take part in the latest panel survey",
        "state": "open",
        "start_date": "2023-03-29T00:00:00",
        "end_date": "2027-03-25T00:00:00",
        "path": "demo/take-part-in-the-latest-panel-survey"
    },
]    
{
  "error": {"error_message": "Forbidden: Unauthorized: activity_search failed permission check"}
}
A visual showing where the 'Key' and 'Secret' can be found on the Citizen Space dashboard
Citizen Space error message