# Stateless JWT auth for Vuejs and Express App

**URL:** <https://community.auth0.com/t/stateless-jwt-auth-for-vuejs-and-express-app/12191>\
**Category:** Get Help\
**Tags:** vuejs, jwt, express-jwt\
**Created:** [June 8, 2018, 8:17am UTC](https://community.auth0.com/t/stateless-jwt-auth-for-vuejs-and-express-app/12191 "2018-06-08T08:17:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alosies](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alosies/32/8007_2.png) [@alosies](https://community.auth0.com/u/alosies)\
**Post date:** [June 8, 2018, 8:17am UTC](https://community.auth0.com/t/stateless-jwt-auth-for-vuejs-and-express-app/12191/1 "2018-06-08T08:17:07Z")

</div>

Hi,

I’m using a facebook only login system. I’m using the following login flow.

1. On clicking the login button, client(Vuejs) redirects to a page rendered directly from the server.
2. Server shows the Auth0 login page, gets the user and makes a JWT.
3. Server redirects to the client page with JWT as query Params.

Issue that I am facing: As sending the token through query params is not very secure I want to know is there a way in which I could send(from client) some kind of code or token to Server, get it validated by the server and get in return a JWT in the response.

I could think of how to achieve this when I am using username and password, but with Auth0 Facebook login, I am not sure what I should be sending in the AJAX call to my server.

Any help would be highly appreciated.

---

<div class="post-metadata">

**Author:** ![thijmen96](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/thijmen96/32/20356_2.png) [@thijmen96](https://community.auth0.com/u/thijmen96)\
**Post date:** [June 8, 2018, 8:06pm UTC](https://community.auth0.com/t/stateless-jwt-auth-for-vuejs-and-express-app/12191/2 "2018-06-08T20:06:41Z")

</div>

There is a ready to use Auth0 flow for this, though. Your Vuejs application is a single page application and your Express app is an API.

> **[Single-Page Applications (SPA) with API](https://auth0.com/docs/get-started/architecture-scenarios/spa-api)**
>
> Explains the architecture scenario where a single-page application (SPA) talks to an API using OpenID Connect (OIDC), and the OAuth 2.0 Implicit Grant Flow, to authenticate users with Auth0.

Just send the access token Auth0 gives your SPA as an `Authentication` header to your Express app and validate it there using the library provided by Auth0.

If you don’t like storing the access token on the client side, you can also just make Auth0 send the callback to your Express app, store the session server side and do the authentication purely on the server side. So the SPA would always load and you wouldn’t have any idea if the user is authenticated until and API call is made. There isn’t a direct doc for that, I believe, but the technique is basically the same as if you were building a straight up regular server side application.

Here is a quickstart to get you going with that too:

[https://auth0.com/docs/quickstart/webapp/nodejs](https://auth0.com/docs/quickstart/webapp/nodejs)

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [July 25, 2019, 1:52pm UTC](https://community.auth0.com/t/stateless-jwt-auth-for-vuejs-and-express-app/12191/3 "2019-07-25T13:52:53Z")

</div>


