<p>with a get request from <code>/index.php?p=admin/actions/users/session-info&amp;dontExtendSession=1</code> I can get my CSRF Code + the User ID. Great.</p>

CC BY-SA 4.0
2020-02-21T11:48:14.713Z
2020-02-21T11:48:14.713Z
Peter L
<p>I build a SPA with Craft CMS and Vue.
I use Vue Router and have three Props. Here is my current router-view:</p>

<pre><code>&lt;router-view 
  csrfName="{{craft.app.config.general.csrfTokenName}}"
  csrfToken="{{craft.app.request.csrfToken}}"
  userID="{{currentUser.id}}"
/&gt;
</code></pre>

<p>I build a user form which works perfect, but it would be great to get the loggedIn userID in the response or via GraphQL. With GraphQL we would have the advantage to check on every site if the user is still signed in  </p>

<p>My log-in template looks the same like above but without the UserID. At the moment I make a hard redirect to my application with the userID because I can't get the data from GraphQL. That means I need to reload the whole page just to get the loggedIn userID. This isn't best practice.</p>

<p>Have someone a idea how I could solve this?</p>

<login><graphql><headless><vue>
getting active userid by GraphQL?
# getting active userid by GraphQL?

(Asked by: username_0 on 2020-02-20)

I build a SPA with Craft CMS and Vue.
I use Vue Router and have three Props. Here is my current router-view:


I build a user form which works perfect, but it would be great to get the loggedIn userID in the response or via GraphQL. With GraphQL we would have the advantage to check on every site if the user is still signed in  
My log-in template looks the same like above but without the UserID. At the moment I make a hard redirect to my application with the userID because I can't get the data from GraphQL. That means I need to reload the whole page just to get the loggedIn userID. This isn't best practice.
Have someone a idea how I could solve this?

**Tags:** login, graphql, headless, vue


---

## 1 answers

### Answer by username_0 on 2020-02-21. Score: 2 | Accepted answer

with a get request from `/index.php?p=admin/actions/users/session-info&dontExtendSession=1` I can get my CSRF Code + the User ID. Great.


---

