Skip to content
This repository was archived by the owner on Feb 26, 2018. It is now read-only.

Commit 3a420fa

Browse files
committed
Update facade name in documentation to avoid conflict with OAuth extension
1 parent 03a2cca commit 3a420fa

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Diff for: readme.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ Eloquent OAuth is a package for Laravel 5 designed to make authentication agains
1313
```php
1414
// Redirect to Facebook for authorization
1515
Route::get('facebook/authorize', function() {
16-
return OAuth::authorize('facebook');
16+
return SocialAuth::authorize('facebook');
1717
});
1818

1919
// Facebook redirects here after authorization
2020
Route::get('facebook/login', function() {
2121

2222
// Automatically log in existing users
2323
// or create a new user if necessary.
24-
OAuth::login('facebook');
24+
SocialAuth::login('facebook');
2525

2626
// Current user is now available via Auth facade
2727
$user = Auth::user();
@@ -66,7 +66,7 @@ Add the facade to the `aliases` array in `config/app.php`:
6666
```php
6767
'aliases' => [
6868
// ...
69-
'OAuth' => 'AdamWathan\EloquentOAuth\Facades\OAuth',
69+
'SocialAuth' => 'AdamWathan\EloquentOAuth\Facades\OAuth',
7070
// ...
7171
]
7272
```
@@ -112,19 +112,19 @@ Authentication against an OAuth provider is a multi-step process, but I have tri
112112

113113
First you will need to define the authorization route. This is the route that your "Login" button will point to, and this route redirects the user to the provider's domain to authorize your app. After authorization, the provider will redirect the user back to your second route, which handles the rest of the authentication process.
114114

115-
To authorize the user, simply return the `OAuth::authorize()` method directly from the route.
115+
To authorize the user, simply return the `SocialAuth::authorize()` method directly from the route.
116116

117117
```php
118118
Route::get('facebook/authorize', function() {
119-
return OAuth::authorize('facebook');
119+
return SocialAuth::authorize('facebook');
120120
});
121121
```
122122

123123
### Authenticating within your app
124124

125125
Next you need to define a route for authenticating against your app with the details returned by the provider.
126126

127-
For basic cases, you can simply call `OAuth::login()` with the provider name you are authenticating with. If the user
127+
For basic cases, you can simply call `SocialAuth::login()` with the provider name you are authenticating with. If the user
128128
rejected your application, this method will throw an `ApplicationRejectedException` which you can catch and handle
129129
as necessary.
130130

@@ -140,7 +140,7 @@ use SocialNorm\Exceptions\InvalidAuthorizationCodeException;
140140

141141
Route::get('facebook/login', function() {
142142
try {
143-
OAuth::login('facebook');
143+
SocialAuth::login('facebook');
144144
} catch (ApplicationRejectedException $e) {
145145
// User rejected application
146146
} catch (InvalidAuthorizationCodeException $e) {
@@ -167,7 +167,7 @@ object that contains basic information from the OAuth provider, including:
167167
- Access Token
168168

169169
```php
170-
OAuth::login('facebook', function($user, $details) {
170+
SocialAuth::login('facebook', function($user, $details) {
171171
$user->nickname = $details->nickname;
172172
$user->name = $details->fullName;
173173
$user->profile_image = $details->avatar;
@@ -197,10 +197,10 @@ But, each provider offers its own sets of additional data. If you need to access
197197
198198
> Note: By increasing the scope you will be asking the user to grant access to additional information. They will be informed of the scopes you're requesting. If you ask for too much unnecessary data, they may refuse. So exercise restraint when requesting additional scopes.
199199
200-
2. Now where you do your `OAuth::login`, store the to your `$user` object by accessing the `$details->raw()['KEY']` data:
200+
2. Now where you do your `SocialAuth::login`, store the to your `$user` object by accessing the `$details->raw()['KEY']` data:
201201

202202
```php
203-
OAuth::login('facebook', function($user, $details) (
203+
SocialAuth::login('facebook', function($user, $details) (
204204
$user->gender = $details->raw()['gender'];
205205
$user->save();
206206
});

0 commit comments

Comments
 (0)