Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: php-actions/composer@8a65f0d3c6a1d17ca4800491a40b5756a4c164f3 # v6
with:
php_version: ${{ matrix.php-version }}
- name: Test with phpunit
- name: Test with API token auth
if: ${{ matrix.php-version == '8.3' &&
github.repository_owner == 'onfido' &&
(github.event_name == 'pull_request' ||
Expand All @@ -52,6 +52,22 @@ jobs:
ONFIDO_SAMPLE_VIDEO_ID_2: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_2 }}
ONFIDO_SAMPLE_MOTION_ID_1: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_1 }}
ONFIDO_SAMPLE_MOTION_ID_2: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_2 }}
- name: Test with OAuth client credentials auth
if: ${{ matrix.php-version == '8.3' &&
github.repository_owner == 'onfido' &&
(github.event_name == 'pull_request' ||
github.event_name == 'release' ||
github.event_name == 'workflow_dispatch') }}
run: |
vendor/bin/phpunit
env:
ONFIDO_OAUTH_CLIENT_ID: ${{ secrets.ONFIDO_OAUTH_CLIENT_ID }}
ONFIDO_OAUTH_CLIENT_SECRET: ${{ secrets.ONFIDO_OAUTH_CLIENT_SECRET }}
ONFIDO_SAMPLE_APPLICANT_ID: ${{ secrets.ONFIDO_SAMPLE_APPLICANT_ID }}
ONFIDO_SAMPLE_VIDEO_ID_1: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_1 }}
ONFIDO_SAMPLE_VIDEO_ID_2: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_2 }}
ONFIDO_SAMPLE_MOTION_ID_1: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_1 }}
ONFIDO_SAMPLE_MOTION_ID_2: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_2 }}

publish:
runs-on: ubuntu-latest
Expand Down
8 changes: 4 additions & 4 deletions .release.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"source": {
"repo_url": "https://github.com/onfido/onfido-openapi-spec",
"short_sha": "6a19890",
"long_sha": "6a198909828b3935c65b669e44cf2927e84957c0",
"version": "v6.0.1"
"short_sha": "6a36202",
"long_sha": "6a362029f0a58437e8be7185303ef14d3f342feb",
"version": "v6.1.0"
},
"release": "v10.1.0"
"release": "v10.2.0"
}
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,27 @@ $onfidoApi = new Onfido\Api\DefaultApi(

```

You can also authenticate using OAuth2 client credentials instead of an API token:

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

$configuration = Onfido\Configuration::getDefaultConfiguration();
$configuration->setOAuthCredentials($_ENV['ONFIDO_OAUTH_CLIENT_ID'], $_ENV['ONFIDO_OAUTH_CLIENT_SECRET']);
$configuration->setRegion(Onfido\Region::EU); // Supports `Region::EU`, `Region::US`, and `Region::CA`

$onfidoApi = new Onfido\Api\DefaultApi(
new \GuzzleHttp\Client([
'timeout' => 30,
'connect_timeout' => 30,
'read_timeout' => 30
]), $configuration);

```

The client will automatically exchange credentials for an access token and refresh it when it expires.

### Making a call to the API

```php
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "onfido/onfido-php",
"version": "10.1.0",
"version": "10.2.0",
"description": "The Onfido Public API (v3.6)",
"keywords": [
"openapitools",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading