Download the PHP package sydefz/freelancer-oauth2-client without Composer
On this page you can find all versions of the php package sydefz/freelancer-oauth2-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sydefz/freelancer-oauth2-client
More information about sydefz/freelancer-oauth2-client
Files in sydefz/freelancer-oauth2-client
Package freelancer-oauth2-client
Short Description Freelancer OAuth 2.0 Client Provider
License MIT
Informations about the package freelancer-oauth2-client
OAuth 2.0 Client
This package makes it simple to integrate your application with freelancer OAuth 2.0 service providers.
Requirements
The following versions of PHP are supported.
- PHP 5.5
- PHP 5.6
- PHP 7.0
- HHVM
Usage
Initialize Freelancer OAuth2 Provider
It is recommended to have an understanding of oauth before using this client. For an introduction to Oauth2, see https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2, or email and ask the Freelancer Identity Team ([email protected]).
Note: Create your application from http://accounts.freelancer.com/settings/create_app and get it approved before you start
Authorization Code Grant
The authorization code grant type is the most common grant type used when authenticating users with freelancer service. This grant type utilizes a client (this library), a server (the service provider), and a resource owner (the user with credentials to a protected or owned resource) to request access to resources owned by the user. This is often referred to as 3-legged OAuth, since there are three parties involved.
Making an authorized request to freelancer API service.
In order to user freelancer API from you applications, your application needs to be created with certain advanced scopes then you can request user to grant these advanced scopes when retrieve access token.
Take POST https://www.freelancer.com/api/projects/0.1/projects/ Doc reference: https://www.freelancer.com/api/docs/#create-new-project Your application needs to have 'fln:project:create' advanced scopes on creation, and your user will need to consent on that scope so the granted access token now have the permission to call this endpoint.
Refreshing a Token
Once your application is authorized, you can refresh an expired token using a refresh token rather than going through the entire process of obtaining a brand new token. To do so, simply reuse this refresh token from your data store to request a refresh.
Client Credentials Grant
When your application is acting on its own behalf to access resources it controls/owns in a service provider, it may use the client credentials grant type. This is best used when the credentials for your application are stored privately and never exposed (e.g. through the web browser, etc.) to end-users. This grant type functions similarly to the resource owner password credentials grant type, but it does not request a user's username or password. It uses only the client ID and secret issued to your client by the service provider.
Install
Via Composer
License
The MIT License (MIT). Please see License File for more information.