Skip to content

Commit a53bb3d

Browse files
committed
Prepare repository for Google provider split
1 parent d3d8550 commit a53bb3d

File tree

5 files changed

+54
-144
lines changed

5 files changed

+54
-144
lines changed

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Contributions are **welcome** and will be fully **credited**.
44

5-
We accept contributions via Pull Requests on [Github](https://github.com/thephpleague/oauth2-client).
5+
We accept contributions via Pull Requests on [Github](https://github.com/thephpleague/oauth2-google).
66

77

88
## Pull Requests

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 Alex Bilbie <hello@alexbilbie.com>
3+
Copyright (c) 2015 Woody Gilk <woody.gilk@gmail.com>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+30-113
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
# OAuth 2.0 Client
1+
# Google Provider for OAuth 2.0 Client
22

3-
[![Build Status](https://travis-ci.org/thephpleague/oauth2-client.svg?branch=master)](https://travis-ci.org/thephpleague/oauth2-client)
4-
[![Coverage Status](https://coveralls.io/repos/thephpleague/oauth2-client/badge.svg?branch=master)](https://coveralls.io/r/thephpleague/oauth2-client?branch=master)
5-
[![Latest Stable Version](https://poser.pugx.org/league/oauth2-client/version.svg)](https://packagist.org/packages/league/oauth2-client)
6-
[![Total Downloads](https://poser.pugx.org/league/oauth2-client/downloads.svg)](https://packagist.org/packages/league/oauth2-client)
3+
[![Build Status](https://img.shields.io/travis/thephpleague/oauth2-google.svg)](https://travis-ci.org/thephpleague/oauth2-google)
4+
[![Code Coverage](https://img.shields.io/coveralls/thephpleague/oauth2-google.svg)](https://coveralls.io/r/thephpleague/oauth2-google)
5+
[![Code Quality](https://img.shields.io/scrutinizer/g/thephpleague/oauth2-google.svg)](https://scrutinizer-ci.com/g/thephpleague/oauth2-google/)
6+
[![License](https://img.shields.io/packagist/l/thephpleague/oauth2-google.svg)](https://github.com/thephpleague/oauth2-google/blob/master/LICENSE)
7+
[![Latest Stable Version](https://img.shields.io/packagist/v/league/oauth2-google.svg)](https://packagist.org/packages/league/oauth2-google)
78

8-
This package makes it stupidly simple to integrate your application with OAuth 2.0 identity providers.
9-
10-
Everyone is used to seeing those "Connect with Facebook/Google/etc" buttons around the Internet and social network
11-
integration is an important feature of most web-apps these days. Many of these sites use an Authentication and Authorization standard called OAuth 2.0.
12-
13-
It will work with any OAuth 2.0 provider (be it an OAuth 2.0 Server for your own API or Facebook) and provides support
14-
for popular systems out of the box. This package abstracts out some of the subtle but important differences between various providers, handles access tokens and refresh tokens, and allows you easy access to profile information on these other sites.
9+
This package provides Google OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).
1510

1611
This package is compliant with [PSR-1][], [PSR-2][] and [PSR-4][]. If you notice compliance oversights, please send
1712
a patch via pull request.
@@ -30,16 +25,25 @@ The following versions of PHP are supported.
3025
* PHP 5.6
3126
* HHVM
3227

28+
## Installation
29+
30+
To install, use composer:
31+
32+
```
33+
composer require league/oauth2-google
34+
```
35+
3336
## Usage
3437

3538
### Authorization Code Flow
3639

3740
```php
38-
$provider = new League\OAuth2\Client\Provider\<ProviderName>([
39-
'clientId' => 'XXXXXXXX',
40-
'clientSecret' => 'XXXXXXXX',
41-
'redirectUri' => 'https://your-registered-redirect-uri/',
42-
'scopes' => ['email', '...', '...'],
41+
$provider = new League\OAuth2\Client\Provider\Google([
42+
'clientId' => '{google-app-id}',
43+
'clientSecret' => '{google-app-secret}',
44+
'redirectUri' => 'https://example.com/callback-url',
45+
'scopes' => ['profile', 'email', '...'],
46+
'hostedDomain' => 'example.com',
4347
]);
4448

4549
if (!isset($_GET['code'])) {
@@ -92,99 +96,16 @@ if (!isset($_GET['code'])) {
9296
### Refreshing a Token
9397

9498
```php
95-
$provider = new League\OAuth2\Client\Provider\<ProviderName>([
96-
'clientId' => 'XXXXXXXX',
97-
'clientSecret' => 'XXXXXXXX',
98-
'redirectUri' => 'https://your-registered-redirect-uri/',
99+
$provider = new League\OAuth2\Client\Provider\Google([
100+
'clientId' => '{google-app-id}',
101+
'clientSecret' => '{google-app-secret}',
102+
'redirectUri' => 'https://example.com/callback-url',
99103
]);
100104

101-
$grant = new \League\OAuth2\Client\Grant\RefreshToken();
105+
$grant = new League\OAuth2\Client\Grant\RefreshToken();
102106
$token = $provider->getAccessToken($grant, ['refresh_token' => $refreshToken]);
103107
```
104108

105-
106-
### Built-In Providers
107-
108-
This package currently has built-in support for:
109-
110-
- Eventbrite
111-
- Facebook
112-
- Github
113-
- Google
114-
- Instagram
115-
- LinkedIn
116-
- Microsoft
117-
118-
These are as many OAuth 2 services as we plan to support officially. Maintaining a wide selection of providers
119-
damages our ability to make this package the best it can be, especially as we progress towards v1.0.
120-
121-
### Third-Party Providers
122-
123-
If you would like to support other providers, please make them available as a Composer package, then link to them
124-
below.
125-
126-
These providers allow integration with other providers not supported by `oauth2-client`. They may require an older version
127-
so please help them out with a pull request if you notice this.
128-
129-
- [Auth0](https://github.com/RiskioFr/oauth2-auth0)
130-
- [Battle.net](https://packagist.org/packages/depotwarehouse/oauth2-bnet)
131-
- [Dropbox](https://github.com/pixelfear/oauth2-dropbox)
132-
- [FreeAgent](https://github.com/CloudManaged/oauth2-freeagent)
133-
- [Google Nest](https://github.com/JC5/nest-oauth2-provider)
134-
- [Mail.ru](https://packagist.org/packages/aego/oauth2-mailru)
135-
- [Meetup](https://github.com/howlowck/meetup-oauth2-provider)
136-
- [Naver](https://packagist.org/packages/deminoth/oauth2-naver)
137-
- [Odnoklassniki](https://packagist.org/packages/aego/oauth2-odnoklassniki)
138-
- [Square](https://packagist.org/packages/wheniwork/oauth2-square)
139-
- [Twitch.tv](https://github.com/tpavlek/oauth2-twitch)
140-
- [Uber](https://github.com/stevenmaguire/oauth2-uber)
141-
- [Vkontakte](https://packagist.org/packages/j4k/oauth2-vkontakte)
142-
- [Yandex](https://packagist.org/packages/aego/oauth2-yandex)
143-
- [ZenPayroll](https://packagist.org/packages/wheniwork/oauth2-zenpayroll)
144-
145-
### Implementing your own provider
146-
147-
If you are working with an oauth2 service not supported out-of-the-box or by an existing package, it is quite simple to
148-
implement your own. Simply extend `League\OAuth2\Client\Provider\AbstractProvider` and implement the required abstract
149-
methods:
150-
151-
```php
152-
abstract public function urlAuthorize();
153-
abstract public function urlAccessToken();
154-
abstract public function urlUserDetails(\League\OAuth2\Client\Token\AccessToken $token);
155-
abstract public function userDetails($response, \League\OAuth2\Client\Token\AccessToken $token);
156-
```
157-
158-
Each of these abstract methods contain a docblock defining their expectations and typical behaviour. Once you have
159-
extended this class, you can simply follow the example above using your new `Provider`.
160-
161-
#### Custom account identifiers in access token responses
162-
163-
Some OAuth2 Server implementations include a field in their access token response defining some identifier
164-
for the user account that just requested the access token. In many cases this field, if present, is called "uid", but
165-
some providers define custom identifiers in their response. If your provider uses a nonstandard name for the "uid" field,
166-
when extending the AbstractProvider, in your new class, define a property `public $uidKey` and set it equal to whatever
167-
your provider uses as its key. For example, Battle.net uses `accountId` as the key for the identifier field, so in that
168-
provider you would add a property:
169-
170-
```php
171-
public $uidKey = 'accountId';
172-
```
173-
174-
### Client Packages
175-
176-
Some developers use this library as a base for their own PHP API wrappers, and that seems like a really great idea. It might make it slightly tricky to integrate their provider with an existing generic "OAuth 2.0 All the Things" login system, but it does make working with them easier.
177-
178-
- [Sniply](https://github.com/younes0/sniply)
179-
180-
## Install
181-
182-
Via Composer
183-
184-
``` bash
185-
$ composer require league/oauth2-client
186-
```
187-
188109
## Testing
189110

190111
``` bash
@@ -193,19 +114,15 @@ $ ./vendor/bin/phpunit
193114

194115
## Contributing
195116

196-
Please see [CONTRIBUTING](https://github.com/thephpleague/oauth2-client/blob/master/CONTRIBUTING.md) for details.
117+
Please see [CONTRIBUTING](https://github.com/thephpleague/oauth2-google/blob/master/CONTRIBUTING.md) for details.
197118

198119

199120
## Credits
200121

201-
- [Alex Bilbie](https://github.com/alexbilbie)
202-
- [Ben Corlett](https://github.com/bencorlett)
203-
- [James Mills](https://github.com/jamesmills)
204-
- [Phil Sturgeon](https://github.com/philsturgeon)
205-
- [Tom Anderson](https://github.com/TomHAnderson)
206-
- [All Contributors](https://github.com/thephpleague/oauth2-client/contributors)
122+
- [Woody Gilk](https://github.com/shadowhand)
123+
- [All Contributors](https://github.com/thephpleague/oauth2-google/contributors)
207124

208125

209126
## License
210127

211-
The MIT License (MIT). Please see [License File](https://github.com/thephpleague/oauth2-client/blob/master/LICENSE) for more information.
128+
The MIT License (MIT). Please see [License File](https://github.com/thephpleague/oauth2-google/blob/master/LICENSE) for more information.

composer.json

+22-29
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,42 @@
11
{
2-
"name": "league/oauth2-client",
3-
"description": "OAuth 2.0 Client Library",
2+
"name": "league/oauth2-google",
3+
"description": "Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client",
44
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "Woody Gilk",
8+
"email": "[email protected]",
9+
"homepage": "http://shadowhand.me"
10+
}
11+
],
12+
"keywords": [
13+
"oauth",
14+
"oauth2",
15+
"client",
16+
"authorization",
17+
"authentication",
18+
"google"
19+
],
520
"require": {
621
"php": ">=5.4.0",
7-
"guzzle/guzzle": "~3.7"
22+
"league/oauth2-client": "~0.10.0"
823
},
924
"require-dev": {
1025
"phpunit/phpunit": "~4.0",
1126
"mockery/mockery": "~0.9",
12-
"squizlabs/php_codesniffer": "~2.0",
13-
"satooshi/php-coveralls": "0.6.*",
14-
"jakub-onderka/php-parallel-lint": "0.8.*"
27+
"squizlabs/php_codesniffer": "~2.0"
1528
},
16-
"keywords": [
17-
"oauth",
18-
"oauth2",
19-
"authorization",
20-
"authentication",
21-
"idp",
22-
"identity",
23-
"sso",
24-
"single sign on"
25-
],
26-
"authors": [
27-
{
28-
"name": "Alex Bilbie",
29-
"email": "[email protected]",
30-
"homepage": "http://www.alexbilbie.com",
31-
"role": "Developer"
32-
}
33-
],
3429
"autoload": {
3530
"psr-4": {
3631
"League\\OAuth2\\Client\\": "src/"
3732
}
3833
},
3934
"autoload-dev": {
4035
"psr-4": {
41-
"League\\OAuth2\\Client\\Test\\": "test/src/"
36+
"League\\OAuth2\\Client\\Test\\": "tests/src/"
4237
}
4338
},
44-
"extra": {
45-
"branch-alias": {
46-
"dev-master": "0.10.x-dev"
47-
}
39+
"branch-alias": {
40+
"dev-master": "0.0.x-dev"
4841
}
4942
}

phpunit.xml phpunit.xml.dist

File renamed without changes.

0 commit comments

Comments
 (0)