Download the PHP package piv915/oauth2-facebook without Composer
On this page you can find all versions of the php package piv915/oauth2-facebook. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download piv915/oauth2-facebook
More information about piv915/oauth2-facebook
Files in piv915/oauth2-facebook
Package oauth2-facebook
Short Description Facebook OAuth 2.0 Client Provider for The PHP League OAuth2-Client
License MIT
Informations about the package oauth2-facebook
Facebook Provider for OAuth 2.0 Client
This package provides Facebook OAuth 2.0 support for the PHP League's OAuth 2.0 Client.
This package is compliant with PSR-1, PSR-2, PSR-4, and PSR-7. If you notice compliance oversights, please send a patch via pull request.
Requirements
The following versions of PHP are supported.
- PHP 5.5
- PHP 5.6
- PHP 7.0
- HHVM
Installation
Add the following to your composer.json
file.
Usage
Authorization Code Flow
The FacebookUser Entity
When using the getResourceOwner()
method to obtain the user node, it will be returned as a FacebookUser
entity.
You can also get all the data from the User node as a plain-old PHP array with toArray()
.
Graph API Version
The graphApiVersion
option is required. If it is not set, an \InvalidArgumentException
will be thrown.
Each version of the Graph API has breaking changes from one version to the next. This package no longer supports a fallback to a default Graph version since your app might break when the fallback Graph version is updated.
See the Graph API version schedule for more info.
Beta Tier
Facebook has a beta tier that contains the latest deployments before they are rolled out to production. To enable the beta tier, set the enableBetaTier
option to true
.
Refreshing a Token
Facebook does not support refreshing tokens. In order to get a new "refreshed" token, you must send the user through the login-with-Facebook process again.
From the Facebook documentation:
Once [the access tokens] expire, your app must send the user through the login flow again to generate a new short-lived token.
The following code will throw a League\OAuth2\Client\Provider\Exception\FacebookProviderException
.
Long-lived Access Tokens
Facebook will allow you to extend the lifetime of an access token by exchanging a short-lives access token with a long-lived access token.
Once you obtain a short-lived (default) access token, you can exchange it for a long-lived one.
Testing
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.