From 63176ec446c59f06945a8ea0d2cc0eea016ca62d Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Mon, 19 Jan 2015 09:27:26 +0300 Subject: [PATCH] Auth Clients guide fixes --- docs/guide/security-auth-clients.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guide/security-auth-clients.md b/docs/guide/security-auth-clients.md index f23c31c8c3..db5d66ffc4 100644 --- a/docs/guide/security-auth-clients.md +++ b/docs/guide/security-auth-clients.md @@ -90,12 +90,12 @@ CREATE TABLE auth ( ); ALTER TABLE auth ADD CONSTRAINT fk-auth-user_id-user-id -FOREIGN KEY user_id REFERENCES auth(id); +FOREIGN KEY user_id REFERENCES user(id); ``` In the SQL above `user` is a standard table that is used in advanced application template to store user info. Each user can authenticate using multiple external services therefore each `user` record can relate to -multiple `auth` records. In the `auth` table `client_name` is the name of the auth provider used and `client_id` is +multiple `auth` records. In the `auth` table `source` is the name of the auth provider used and `source_id` is unique user identificator that is provided by external service after successful login. Using tables created above we can generate `Auth` model. No further adjustments needed. @@ -183,8 +183,8 @@ class SiteController extends Controller we can retrieve information received. In our case we'd like to: - If user is guest and record found in auth then log this user in. -- If user is logged in and record found in auth then try connecting additional account (save its data into auth table). - If user is guest and record not found in auth then create new user and make a record in auth table. Then log in. +- If user is logged in and record not found in auth then try connecting additional account (save its data into auth table). Although, all clients are different they shares same basic interface [[yii\authclient\ClientInterface]], which governs common API.