smartoweb / flickroauth1
Unofficial Oauth 1.0 adapter for flickr API
v0.3
2017-12-13 16:42 UTC
Requires
- php: >=5.4.0
- league/oauth1-client: ~1.2
This package is not auto-updated.
Last update: 2024-04-28 02:43:00 UTC
README
Flickr Oauth1 client provider for thephpleague/oauth1-client (see https://github.com/thephpleague/oauth1-client).
Installation
composer require smartoweb/flickroauth1
Usage
Usage is the same as The League's OAuth client, using smartoweb\OAuth1\Client\Server\Flickr
as the provider.
1/ Initialize and store server class, retrieve and store temporary credentials and redirect user to Flickr autorization screen
$server = new smartoweb\OAuth1\Client\Server\Flickr([ 'identifier' => 'your-client-id', 'secret' => 'your-client-secret', 'callback_uri' => 'http://callback.url/callback', ]); #...store $server for use it in callback_uri function $temporaryCredentials=$server->getTemporaryCredentials(); #...store $temporaryCredentials for use it in callback_uri function $server->authorize($state);
2/ In callback_uri function get Oauth1 $token
$oauth_token=!empty($_GET['oauth_token'])?$_GET['oauth_token']:''; $oauth_verifier=!empty($_GET['oauth_verifier'])?$_GET['oauth_verifier']:''; if ($oauth_token!='' && $oauth_verifier!='') { $server=#...stored $server $temporaryCredentials=#...stored $temporaryCredentials $token = $server->getTokenCredentials($temporaryCredentials, $oauth_token, $oauth_verifier); #...store $token }