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/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude onfido
- name: Test with pytest
- name: Test with API token auth
if: ${{ matrix.python-version == '3.13' &&
github.repository_owner == 'onfido' &&
(github.event_name == 'pull_request' ||
Expand All @@ -72,6 +72,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.python-version == '3.13' &&
github.repository_owner == 'onfido' &&
(github.event_name == 'pull_request' ||
github.event_name == 'release' ||
github.event_name == 'workflow_dispatch') }}
run: |
poetry run pytest --show-capture=no
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": "v6.1.0"
"release": "v6.2.0"
}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,23 @@ with onfido.ApiClient(configuration) as api_client:
...
```

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

```python
configuration = onfido.Configuration(
oauth_client_id=environ['ONFIDO_OAUTH_CLIENT_ID'],
oauth_client_secret=environ['ONFIDO_OAUTH_CLIENT_SECRET'],
region=onfido.configuration.Region.EU,
timeout=urllib3.util.Timeout(connect=60.0, read=60.0)
)

with onfido.ApiClient(configuration) as api_client:
onfido_api = onfido.DefaultApi(api_client)
...
```

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

NB: by default, timeout values are set to 30 seconds. You can change the default timeout values by setting the `timeout` parameter in the `Configuration` object, as shown in the example above.

### Making a call to the API
Expand Down
2 changes: 1 addition & 1 deletion onfido/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
""" # noqa: E501


__version__ = "6.1.0"
__version__ = "6.2.0"

# Define package exports
__all__ = [
Expand Down
Loading
Loading