NAV Navbar

Passbase API Reference

The Passbase API is organized in a JavaScript snippet for web and mobile SDKs. Please follow the integration guide for your platform as well as select on the right side, for which language and integration. e.g. If you wish to integrate it for iOS please select "swift", if you want to integrate for Web, please select "JavaScript".

If you have questions about the integration, discovered a bug or need help and want to reach out directly to us, you can join our Developer Help Slack Channel.

Web

To integrate the Passbase verification on your Website, please follow this guide and use your own API Key which you can obtain from the developer dashboard.

The integration a Passbase Button follows three simple steps:

  1. Include a JavaScript for loading the button
  2. Render and initialize the button with your API key
  3. Start a new verification process from a button

Install the SDK

<!-- Place this javascript source tag in the header of every page that should include the button -->
<script type="text/javascript" src="https://dashboard.passbase.com/button.js"></script>

All you have to do is putting this one line of code inside the header file where you want to integrate the button.

iOS

To integrate the Passbase SDK follow this guide and use your own API Key which you can obtain from the developer dashboard.

The integration of the Passbase iOS SDK follows three simple steps:

  1. Install the SDK through Cocoapods
  2. Initialization of the SDK with your API key
  3. Start a new verification process from a button

1. Install the SDK

# Uncomment the next line to define a global platform for your project
platform :ios, '12.1'

target 'YourApp' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  pod 'Passbase'

  target 'YourAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'YourAppUITests' do
    inherit! :search_paths
    # Pods for testing
  end
end

We use Cocoapods as dependency manager. If you don't have it yet installed, please follow Step 1-2 from this guide Install Cocoapods.

If you don't have a Podfile in your project yet, create one. For this open terminal and navigate to your iOS project's folder:

cd YourProject

pod init

You should have now a Podfile. Open this file and add the following code to it. Check the example on the right side to see where to place add it.

pod 'Passbase'

To install the SDK inside your project, go back to your terminal. Run the following command inside your project:

pod install

2. Initialize the SDK

Initialize the SDK in AppDelegate

// Add this to the top of your AppDelegate
import Passbase

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

  // Initialize the SDK with your API key
    Passbase.initialize(apiKey: "YOUR_API_KEY")

    return true
}

Passbase uses API keys to allow access to the API and route it back to your dashboard. You need to register on our website to create a new Passbase API key here: Developer Dashboard.

Open now your Workspace File in your directory that has been created through the previous step. It will be called something like YourProject.xcworkspace.

Now open your AppDelegate.swift file and add import Passbase to the top to import the Passbase SDK. After that add Passbase.initialize(apiKey: "YOUR_API_KEY") within your didFinishLaunchingWithOptions function with your own API key.

An example is again in the code section here.

Adjust your App's permissions

You need to add the following two permissions to your App's Info.plist, so that the Passbase SDK can access the Camera and Microphone to verify a user:

alt text

3. Start the Verification

To start a new verification you can either trigger it through the StoryBoard or by code. This section will walk you through both.

Start Verification through the StoryBoard

Two simple steps to get the button running:

  1. Just drag a button on your storyboard and give it all the constraints you want.
  2. Subclass the button as PassbaseButton. Ensure that the module also says Passbase.

alt text

That's it. The button should now automatically be rendered and trigger the verification flow like below.

alt text

Start Verification programmatically

override func viewDidLoad() {
  super.viewDidLoad()

  let button = PassbaseButton(frame: CGRect(x: 100, y: 100, width: 250, height: 55))
  self.view.addSubview(button)
}

To start the button programmatically, create a new button of type PassbaseButton.

TBD

Example Integration

You can find an example project here.

Errors

The Passbase API uses the following error codes:

Error Code Meaning
400 Bad Request -- Your request is invalid.
401 Unauthorized -- Your API key is wrong.
403 Forbidden -- The kitten requested is hidden for administrators only.
404 Not Found -- The specified kitten could not be found.
405 Method Not Allowed -- You tried to access a kitten with an invalid method.
406 Not Acceptable -- You requested a format that isn't json.
410 Gone -- The kitten requested has been removed from our servers.
418 I'm a teapot.
429 Too Many Requests -- You're requesting too many kittens! Slow down!
500 Internal Server Error -- We had a problem with our server. Try again later.
503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.