Answers.Body: <p>You are going to have a hard time if you want to use Yii2 with Craft 2 since they are totally incompatible. Craft 2 uses yii and Craft 3 uses Yii2. You can't mix them. Furthermore you'll need multiple custom changes when you want to drop the native Craft user registration and replace it with Yii2 (less powerful) user registration. (what's wrong about Crafts one?)</p>
  
  <p>Do you have certain reasons why you are not going to use existing ways? I can't think of a "fast and easy" way to achieve your goal, especially if you are new to Craft because it's a lot of work to drop existing login/registration mechanisms.</p>
  
  <p>Here is an example how to register users with Craft methods <a href="https://docs.craftcms.com/v3/templating/examples/user-registration-form.html" rel="nofollow noreferrer">https://docs.craftcms.com/v3/templating/examples/user-registration-form.html</a> you can include the permission to give them CP access and redirect them there </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-10T06:32:02.643Z
Answers.LastActivityDate: 2018-06-10T06:32:02.643Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I'm building a system which should have two parts CMS using craft cms 2.6.x. and Yii2 for logical modules and administration. I want to login to CMS directly once the user has logged into yii2 system. How can I do that? I can pass uid which in craft_user table. I need to build an API function but where shall I start? 
  Plus is this a good practice or there is something else I can do. </p>
  
  <p>Thanks, </p>
  
Tags: <authentication>
Title: API Authentication for Craft CMS
ThreadText: # API Authentication for Craft CMS
  
  (Asked by: username_0 on 2018-06-10)
  
  I'm building a system which should have two parts CMS using craft cms 2.6.x. and Yii2 for logical modules and administration. I want to login to CMS directly once the user has logged into yii2 system. How can I do that? I can pass uid which in craft\_user table. I need to build an API function but where shall I start?
  Plus is this a good practice or there is something else I can do.
  
  Thanks,
  
  **Tags:** authentication
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-06-10. Score: 2
  
  You are going to have a hard time if you want to use Yii2 with Craft 2 since they are totally incompatible. Craft 2 uses yii and Craft 3 uses Yii2. You can't mix them. Furthermore you'll need multiple custom changes when you want to drop the native Craft user registration and replace it with Yii2 (less powerful) user registration. (what's wrong about Crafts one?)
  
  Do you have certain reasons why you are not going to use existing ways? I can't think of a "fast and easy" way to achieve your goal, especially if you are new to Craft because it's a lot of work to drop existing login/registration mechanisms.
  
  Here is an example how to register users with Craft methods <https://docs.craftcms.com/v3/templating/examples/user-registration-form.html> you can include the permission to give them CP access and redirect them there
  
  
  ---
  
  