Skip to content
Paul D Barham edited this page Feb 12, 2020 · 4 revisions

API Authentication

PLEASE NOTE: the API's have not been maintained for about a year. You will find the routes in routes/api.php. The API controllers are in app/Http/Controllers/API

Setup APP_URL in the .env file

APP_URL=http://cmr-clinic-admin-api.test

Setup Passport

php artisan passport:keys --force
php artisan passport:install --force

Put these keys as comments in your .env

Create accessToken for API

  php artisan tinker
  >>> $user = User::find(1)
  >>> $token = $user->createToken('Hackerpair')->accessToken
  => "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs...Um1Py-KdjXfQ"

Added token to .env for testing

PASSWORD_CLIENT_ID=2
TEST_API_TOKEN="eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni..."

Test the API - For Server to Server connection

In OSX not your Vagrant box

php artisan cms:api-test

This is approximately what we are sending.

Applicant

Case

Charge