Authentication with VueJs using Symfony and Api Platform — Part 1

Stefano Alletti
Aug 5, 2019 · 2 min read

Authentication with VueJs using Symfony and Api Platform — Part 1

During my experience as a software developer, I have observed that one of the most delicate issues is authentication. So I wanted to add a brick to my previous post, in order to explain how to set up a basic authentication process.

Starting from the Bookstore application that we created during the previous PoC, let’s say we now want to add a user account that allows the authenticated user to view and change his personal data. We also want to protect the API that provides the data to the front office.
Thus there are two distinct types of authentication to manage. The first one authorizes a user to use the application and the second one authorizes a client (Web, Mobile or an external source) to use our APIs. We will also see how to integrate both authentication processes into a VueJs application.

Let’s proceed step by step.

1. Install Symfony Security component

$ composer require symfony/security-bundle

2. Protect yours APIs

Adding authentication with Api Platform is very simple. The official documentation explains how to implement it, using a JWTauthentication and the excellent LexikJWTAuthenticationBundle. But for simplicity we will use a basic authentication, with a simple md5 token that will be generated at the user’s creation.

Continue reading at:

Stefano Alletti

Written by

Freelance web developer 🇮🇹 🇫🇷🇬🇧

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade