oat-sa / extension-tao-oauth
Extension to easily configure an OAuth client for OAT platform.
Installs: 16 499
Dependents: 3
Suggesters: 0
Security: 0
Stars: 3
Watchers: 47
Forks: 1
Open Issues: 1
Type:tao-extension
Requires
- league/oauth2-client: ^2.0
- oat-sa/generis: >=14.0.0
- oat-sa/oatbox-extension-installer: ~1.1||dev-master
- oat-sa/tao-core: >=54.21.0
- dev-master
- v6.1.1
- v6.1.0
- v6.0.4
- v6.0.3
- v6.0.2
- v6.0.1
- v6.0.0
- v5.3.1.1
- v5.3.1
- v5.2.1
- v5.2.0
- v5.1.0
- v5.0.0
- v4.1.1
- v4.1.0
- v4.0.0
- v2.0.0
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.3
- v1.0.1
- v1.0.0
- v0.2.2
- v0.2.1
- v0.0.6
- v0.0.5
- v0.0.4
- v0.0.3
- v0.0.2
- dev-develop
- dev-feature/sonarqube-integration
- dev-fix/update-autoRelease-action-with-bot-user
- dev-feature/AUT-2995
- dev-release-v5.3.1.1
- dev-backport/ADF-959/fix_cache_issue
- dev-remove-jenkinsfile
- dev-feature/tdr-1/phpunit8_upgrade
- dev-fix/NCC-152/AssignmentsReportKeepsTracksOfAssignment
- dev-feature/NEX-417-reports-not-shown-for-failed-publication
- dev-feature/NEX-320/lti-lis-oauth-validator
- dev-feature/delete-dependency-with-tao-publishing
- dev-fix/remove-unused-code
- dev-fix/default-accept-encoding
- dev-feature/TAO-6107/sprint-73/added-role-for-consumer
- dev-release_0.0.5
This package is auto-updated.
Last update: 2024-11-11 09:06:35 UTC
README
Extension to easily configure an OAuth client for OAT platform.
Setting up OAuth
- At host server run console script to generate credentials:
php index.php '\oat\taoOauth\scripts\tools\GenerateCredentials' -r $role
. (final bash inliner may vary according to your server); It will return $key, $secret and $tokenUrl, which should be used to generate auth token. This data should be stored in your client env.
Response:
Client generated with credentials :
- client key : c35b263b78fa20aa560702a232fff5fc
- client secret : GSJ2z6xH3E3MelJbXA6AmQeQeYfCRueg3af9a92aba6bfc28559a8c5689adbc87fd901f18b00671e3bc5d5566f5af5e38
- token url : https://taotesting.com/taoOauth/TokenApi/requestToken
- If your client server works with Tao, you can run script which will import credentials to allow authentication against host server:
php index.php '\oat\taoOauth\scripts\tools\ImportConsumer' -k $key -s $secret -tu $tokenUrl -r $role
.
Using OAuth authentication
After generate of credentials you need to generate token for connections to the tao endpoints. For this you need to make request:
curl -X POST \
https://taotesting.com/taoOauth/TokenApi/requestToken \
-H 'Accept: application/json' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-d 'client_id=c35b263b78fa20aa560702a232fff5fc&client_secret=GSJ2z6xH3E3MelJbXA6AmQeQeYfCRueg3af9a92aba6bfc28559a8c5689adbc87fd901f18b00671e3bc5d5566f5af5e38'
where $key
and $secret
your credentials from previous example.
It will return $access_token
and $expires
, which should be used to generate Authorization
header:
{
"access_token": "hJFpTCo9Bvd30b7eb63ef28af1a7ce081252e9844053a9a4a38112ecb8c41eeedfd58f8907",
"expires": 1521475157
}
Request with OAuth Authorization
header
Example:
curl -X GET \
'https://taotesting.com/taoDeliveryRdf/RestDelivery/getStatus?id=https%3A%2F%2Ftaotesting.com%2Ftao.rdf%23i15203488932024127 \
-H 'Accept: application/json' \
-H 'Authorization: Bearer hJFpTCo9Bvd30b7eb63ef28af1a7ce081252e9844053a9a4a38112ecb8c41eeedfd58f8907' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \