Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
6ba7b523
Commit
6ba7b523
authored
Oct 10, 2014
by
Klimov Paul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'authclient' docs adjusted
parent
0fa36940
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
8 deletions
+36
-8
README.md
extensions/authclient/README.md
+36
-8
No files found.
extensions/authclient/README.md
View file @
6ba7b523
...
@@ -32,7 +32,7 @@ It covers OpenID, OAuth1 and OAuth2 protocols.
...
@@ -32,7 +32,7 @@ It covers OpenID, OAuth1 and OAuth2 protocols.
You need to setup auth client collection application component:
You need to setup auth client collection application component:
```
```
php
'components'
=>
[
'components'
=>
[
'authClientCollection'
=>
[
'authClientCollection'
=>
[
'class'
=>
'yii\authclient\Collection'
,
'class'
=>
'yii\authclient\Collection'
,
...
@@ -53,7 +53,7 @@ You need to setup auth client collection application component:
...
@@ -53,7 +53,7 @@ You need to setup auth client collection application component:
Then you need to add
[
[yii\authclient\AuthAction
]
] to some of your web controllers:
Then you need to add
[
[yii\authclient\AuthAction
]
] to some of your web controllers:
```
```
php
class
SiteController
extends
Controller
class
SiteController
extends
Controller
{
{
public
function
actions
()
public
function
actions
()
...
@@ -76,7 +76,7 @@ class SiteController extends Controller
...
@@ -76,7 +76,7 @@ class SiteController extends Controller
You may use
[
[yii\authclient\widgets\AuthChoice
]
] to compose auth client selection:
You may use
[
[yii\authclient\widgets\AuthChoice
]
] to compose auth client selection:
```
```
php
<?=
yii\authclient\widgets\AuthChoice
::
widget
([
<?=
yii\authclient\widgets\AuthChoice
::
widget
([
'baseAuthUrl'
=>
[
'site/auth'
]
'baseAuthUrl'
=>
[
'site/auth'
]
])
?>
])
?>
...
@@ -132,7 +132,8 @@ it may be not enough to access full external API functionality. This method is m
...
@@ -132,7 +132,8 @@ it may be not enough to access full external API functionality. This method is m
fetch the external user account data.
fetch the external user account data.
To use API calls, you need to setup
[
[yii\authclient\BaseOAuth::apiBaseUrl
]
] according to the
To use API calls, you need to setup
[
[yii\authclient\BaseOAuth::apiBaseUrl
]
] according to the
API specification. Then you can call
[
[yii\authclient\BaseOAuth::api()
]
] method:
API specification. Then you can call
[
[yii\authclient\BaseOAuth::api()
]
] method:
```
```
php
use
yii\authclient\OAuth2
;
use
yii\authclient\OAuth2
;
$client
=
new
OAuth2
;
$client
=
new
OAuth2
;
...
@@ -164,6 +165,33 @@ Following predefined auth clients are available:
...
@@ -164,6 +165,33 @@ Following predefined auth clients are available:
Please, refer to the particular client class documentation for its actual usage.
Please, refer to the particular client class documentation for its actual usage.
Customize auth clients
----------------------
All predefined auth clients have a default configuration like
`authUrl`
,
`apiBaseUrl`
and so on.
However in some cases you may want to change these values in order to achieve some specific results.
For example: using
`yii\authclient\clients\Facebook`
you may want the auth window appear in popup display
mode, which is setup via
`authUrl`
:
```
php
'components'
=>
[
'authClientCollection'
=>
[
'class'
=>
'yii\authclient\Collection'
,
'clients'
=>
[
'facebook'
=>
[
'class'
=>
'yii\authclient\clients\Facebook'
,
// Facebook login form will be displayed in 'popup' mode
'authUrl'
=>
'https://www.facebook.com/dialog/oauth?display=popup'
,
'clientId'
=>
'facebook_client_id'
,
'clientSecret'
=>
'facebook_client_secret'
,
],
],
]
...
]
```
Creating your own auth clients
Creating your own auth clients
------------------------------
------------------------------
...
@@ -178,7 +206,7 @@ for your extension:
...
@@ -178,7 +206,7 @@ for your extension:
At this stage you can determine auth client default name, title and view options, declaring
At this stage you can determine auth client default name, title and view options, declaring
corresponding methods:
corresponding methods:
```
```
php
use
yii\authclient\OAuth2
;
use
yii\authclient\OAuth2
;
class
MyAuthClient
extends
OAuth2
class
MyAuthClient
extends
OAuth2
...
@@ -211,7 +239,7 @@ All you need is specify auth URL, by redeclaring "authUrl" field.
...
@@ -211,7 +239,7 @@ All you need is specify auth URL, by redeclaring "authUrl" field.
You may also setup default required and/or optional attributes.
You may also setup default required and/or optional attributes.
For example:
For example:
```
```
php
use
yii\authclient\OpenId
;
use
yii\authclient\OpenId
;
class
MyAuthClient
extends
OpenId
class
MyAuthClient
extends
OpenId
...
@@ -239,7 +267,7 @@ You will need to specify:
...
@@ -239,7 +267,7 @@ You will need to specify:
For example:
For example:
```
```
php
use
yii\authclient\OAuth2
;
use
yii\authclient\OAuth2
;
class
MyAuthClient
extends
OAuth2
class
MyAuthClient
extends
OAuth2
...
@@ -273,7 +301,7 @@ You will need to specify:
...
@@ -273,7 +301,7 @@ You will need to specify:
For example:
For example:
```
```
php
use
yii\authclient\OAuth1
;
use
yii\authclient\OAuth1
;
class
MyAuthClient
extends
OAuth1
class
MyAuthClient
extends
OAuth1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment