Answers.Body: <pre><code>Craft::$app-&gt;getUser()
  </code></pre>
  
  <p>returns only the user service/component. You should read the <a href="https://docs.craftcms.com/api/v3/craft-services-users.html" rel="noreferrer">docs</a> about that</p>
  
  <p>What you want is the current Identity</p>
  
  <pre><code>Craft::$app-&gt;getUser()-&gt;getIdentity()
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-28T21:34:43.187Z
Answers.LastActivityDate: 2018-04-28T21:34:43.187Z
Answers.UserDisplayName: Robin Schambach
Body: <p>Trying to get the currently logged in user's groups. Trying to get at that by using the user ID. I am currently testing as Admin - user number 1.</p>
  
  <pre><code>Craft::$app-&gt;getUser()-&gt;id
  </code></pre>
  
  <p>Returns a user ID (11) that does not exist in the Users table. The Users table has ID's of 1, 20, 21.</p>
  
  <p>How do I get user ID or more specifically, the currently logged in user's groups?</p>
  
Tags: <plugin-development><craft3>
Title: Getting info on the currently logged in user
ThreadText: # Getting info on the currently logged in user
  
  (Asked by: username_0 on 2018-04-28)
  
  Trying to get the currently logged in user's groups. Trying to get at that by using the user ID. I am currently testing as Admin - user number 1.
  
  ```
  Craft::$app->getUser()->id
  
  ```
  
  Returns a user ID (11) that does not exist in the Users table. The Users table has ID's of 1, 20, 21.
  
  How do I get user ID or more specifically, the currently logged in user's groups?
  
  **Tags:** plugin-development, craft3
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-04-28. Score: 15 | Accepted answer
  
  ```
  Craft::$app->getUser()
  
  ```
  
  returns only the user service/component. You should read the [docs](https://docs.craftcms.com/api/v3/craft-services-users.html) about that
  
  What you want is the current Identity
  
  ```
  Craft::$app->getUser()->getIdentity()
  
  ```
  
  
  ---
  
  