Download the PHP package diglin/oauth2-oro-provider without Composer
On this page you can find all versions of the php package diglin/oauth2-oro-provider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download diglin/oauth2-oro-provider
More information about diglin/oauth2-oro-provider
Files in diglin/oauth2-oro-provider
Package oauth2-oro-provider
Short Description Symfony bundle - OAuth2 Oro Client provider
License MIT
Informations about the package oauth2-oro-provider
OAuth2 Client for OroPlatform based applications
Introduction
This Symfony 4.x & 5.x Bundle allows you to authenticate and connect to OroPlatform based applications API via the OAUth2 protocol.
This bundle extends the league/oauth2-client
dependency and will be automatically installed. Fur further information about the dependency, visit the url https://github.com/thephpleague/oauth2-client
Compatibility
- OroPlatform 4.x & 5.x with OAuth Server active on OroPlatform side
- Symfony 4.x | 5.x
Installation
Via composer:
composer require diglin/oauth2-oro-provider:^1.0
Configuration
The default configuration of DiglinOAuth2OroBundle is illustrated below:
Create a file at the path config/packages/diglin_oauth2_oro.yaml
(you can set also this file at environment level, like into the prod or dev folder.) with the following content example:
url
: should looks likehttps://my-domain.com
client_id
andclient_secret
: you can get the value from OroPlatform - see https://doc.oroinc.com/user/back-office/system/user-management/oauth-app/#oauth-applicationsgrant_type
: can bepassword
orclient_credentials
.client_credentials
is recommended
As stated in Oro Documentation:
The Client Credentials type is used for machine-to-machine authentication (e.g. in a cron job that performs maintenance tasks over an API) and Password is used by trusted first-party clients to exchange the credentials (username and password) for an access token. OAuth advises to use client_credentials
Usage
Create an Endpoint implementing the \Diglin\OAuth2OroBundle\Api\Endpoints\EndpointInterface
interface. Your class can looks like this:
Then in your code you can do the following (be aware, the code below should be adapted of course)
Tips
To get the list of available endpoints on your Oro Application, you can request the url https://myoroapp.com/api/doc
(if you use OroCommerce, there is a difference between frontend and backend, in this case the admin url for backend API may looks like this https://myoroapp.com/admin/api/doc
)
PHP Test compatibility
Run ./vendor/bin/phpcs -p src --standard=PHPCompatibility --runtime-set testVersion 8.1
TODO
- Storage of the API token and take in account the use of the refresh token
License
See LICENSE.txt
Author
- Diglin GmbH
- https://www.diglin.com/
- @diglin_
- Follow us on github!
All versions of oauth2-oro-provider with dependencies
league/oauth2-client Version ^2.4
symfony/config Version ^4.4|^5.4|^6.1
symfony/http-kernel Version ^4.4|^5.4|^6.1
symfony/dependency-injection Version ^4.4|^5.4|^6.1