No description, website, or topics provided.
PHP
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
src/Bit6
.gitignore
LICENSE
Procfile
README.md
app.json
composer.json
composer.lock

README.md

Bit6 Token Generator for PHP

A super simple application demonstrating the external authentication in Bit6.

Prerequisites

Running Locally

$ git clone git@github.com:bit6/bit6-token-generator-php.git
$ cd bit6-token-generator-php
$ composer update

Specify your Bit6 API key and secret using environment variables or a local .env config file. The file should contain two lines:

BIT6_API_KEY=abc
BIT6_API_SECRET=xyz

Start the application

$ php -S localhost:5000 -t example/
# Alternatively run:
# heroku local

Your app should now be running on localhost:5000.

Deploying to Heroku

Make sure you have the Heroku Toolbelt installed.

$ heroku create
$ git push heroku master

or

Deploy to Heroku

Set Bit6 API key and secret:

$ heroku config:set BIT6_API_KEY=abc
$ heroku config:set BIT6_API_SECRET=xyz

Generating a Token

You would normally generate an external token by doing a POST from your app client to your application server. To simulate this using curl:

curl -X POST \
    -H "Content-Type: application/json" \
    -d '{"identities": ["usr:john","tel:+12123331234"]}' \
    http://localhost:5000/auth.php

The response should be a JSON object:

{
    "ext_token": "..."
}

Documentation

For more information about using PHP on Heroku, see these Dev Center articles: