Download the PHP package joomla/oauth1 without Composer
On this page you can find all versions of the php package joomla/oauth1. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joomla/oauth1
More information about joomla/oauth1
Files in joomla/oauth1
Package oauth1
Short Description Joomla OAuth1 Package
License GPL-2.0-or-later
Homepage https://github.com/joomla-framework/oauth1
Informations about the package oauth1
The OAuth1 Package
Using the OAuth1 Package
The OAuth1 package supports OAuth 1.0 and 1.0a protocol versions. The client facilitates authorised RESTful HTTP requests. You can find the OAuth RFC at http://tools.ietf.org/html/rfc5849.
The Client is abstract, it must be extended and have the two abstract methods implemented. These methods are verifyCredentials and validateResponse:
- verifyCredentials is used to check if an existing access token is still valid. Servers may have different ways of testing the access token validity, for example Twitter has a specific URL for this. There are several reasons an access token may be invalid: the token expires after some time, the user changes his password which invalidates the access token, the user de-authorizes your app, the user logs out.
- validateResponse method is used to check the response codes. This method abstract because servers may have different response error bodies.
By default the client will act as an OAuth 1.0a client. If you need an OAuth 1.0 client, than you have to set the constructor $version parameter to '1.0'. The client requires additional options and this can be done by injecting in a Registry object:
By default you have to set and send headers manually in your application, but if you want this to be done automatically by the client you can set Registry option 'sendheaders' to true.
Now you can authenticate the user and request him to authorise your application in order to get an access token, but if you already have an access token stored you can set it and if it's still valid your application will use it.
When calling the authenticate() method, your stored access token will be used only if it's valid, a new one will be created if you don't have an access token or if the stored one is not valid. The method will return a valid access token that's going to be used.
Now you can perform authorised requests using the oauthRequest method.
A More Complete Example
See the Twitter and LinkedIn packages for examples demonstrating more about the OAuth1 package.
TODO: add links to the Twitter and LinkedIn packages after this packages are merged.
More Information
The following resources contain more information:
- [http://api.joomla.org/](Joomla! API Reference)
- [http://tools.ietf.org/html/rfc5849](OAuth RFC)
Installation via Composer
Add "joomla/oauth1": "~3.0"
to the require block in your composer.json and then run composer install
.
Alternatively, you can simply run the following from the command line:
All versions of oauth1 with dependencies
joomla/application Version ^3.0
joomla/http Version ^3.0
joomla/input Version ^3.0
joomla/registry Version ^3.0
joomla/session Version ^3.0
joomla/uri Version ^3.0