Stateless CSRF Protection in an SPA

Coming from a traditional full stack background where both the frontend and backend were not separate apps, protecting against CSRF attacks when the two ends are separated, was a little confusing for me. How do I pass the CSRF token to my frontend app? Should I make an endpoint that generates a CSRF token? How is that even safe when anyone could access it and get one? It was a little difficult to find a straight forward answer but after a lot of reading I think I figured it out. When should you use a CSRF token and when do

Continue reading

How to store a JWT in a cookie and auto-refresh the token using LexikJWTAuthenticationBundle

Looking to store your JWT in a cookie and auto refresh it before it expires when using the LexikJWTAuthenticationBundle? There’s a setting that tells the bundle to look for a JWT cookie, but there’s nothing that actually creates the cookie for you. That needs to be done manually. I’m going to assume if you’re here, you already have the bundle installed and are just looking for a way to store the JWT in a cookie, so I’m going to get straight to how you do it. Update the LexikJWTAuthenticationBundle config To tell the bundle that you want it to look

Continue reading

How to use git

Git can be a pain to learn when you’re first starting out. It didn’t actually click with me until I started using it everyday when I got a job. So, I thought it would be good to put together this little tutorial that I wish I had seen before starting my job. It would have helped me to understand git a whole lot more. Installing Git To start if you haven’t done so already, you’ll need to install git on your computer. Go to https://git-scm.com/downloads and download the version for your operating system. I’m on Windows, but the processes should

Continue reading

Vue.js Practice Project Ideas

Once you’ve done a few tutorials, usually it’s a good idea to work on something without an exact step by step guide. So, if that’s what you’re looking for, here are three project ideas that you can build. They’re all smaller projects so you can probably get them done in a couple hours to a few days. 1. QR Code Generator (Beginner) There’s a cool little service, QRtag.net, that lets you generate QR codes on the fly without any kind of backend process. You simply append the url you want to generate a QR code for to their api url

Continue reading

Tips for Integrating Vue.js into an Existing Project

A few months back I started to integrate Vue.js into an existing site at work. There was a new page they wanted that had a somewhat complicated UI so I thought it would be a good way to get some more experience with Vue. Since most tutorials teach you Vue from a standpoint of building a new site, I had to dig a little deeper to find out the best way to use Vue on an existing site. Here’s some of the more helpful things I learned while working on this project. Note: I’ll preface this by saying prior to

Continue reading

When should you use Vuex?

Have you ever heard the response: “you’ll just know”, when asking someone when you should use Vuex. Yeah, me too. When you ask this question anywhere online you get some good advice but you also get a lot of vague answers like: “You’ll just know” or “Vuex solves specific problems” (never actually says what kinds of problems) Hopefully with this post I’ll help you to know when it’s a good time to start using Vuex. I’m assuming you have an idea of what Vuex is if you found this page but just in case you don’t, here’s how the actual

Continue reading

Vue.js Server Side Rendering with PHP

Trying to get server side rendering to work with PHP to render your Vue.js app but are stuck? There’s a lot of great resources out there but I haven’t found anything that just works out of the box without some digging. Hopefully, after this post you’ll have a better idea of how to accomplish server side rendering for your Vue.js app! Requirements PHP 7.2 Node.js (My server has v8.9.4, I’m unsure if it will work on earlier versions, but if you have at least this version you should be good!) Creating our Vue App For this example, we’re going to

Continue reading

Finishing the Question/Answer App

Creating a website with Symonfy 4: Part 4 This post is part of a series where we’ve been building a Question/Answer web app. So far we have our login system built and the ability to ask a question. Today we’ll be updating our homepage to pull questions from the database, we’ll add the ability to answer questions, update our menu and add a way to track views on a question. If you haven’t been following from the start, you can download the code up to this point here. With that said, let’s get started! Updating our Menu To get the

Continue reading

Working with Symfony 4 Forms & Doctrine Entities

Creating a website with Symonfy 4: Part 3 In today’s post we’ll be adding the ability to ask questions! If you haven’t been following along, this is a tutorial series so if you want to start from the beginning check out this post first. If you want to jump ahead, click here, to download a copy of the code. In this part we’re going to be adding some menu links and showing different ones depending on if the user is logged in, we’ll create the form to ask a question and then a page that displays the question. Let’s get

Continue reading

Symfony 4 Login & Registration System

Creating a website with Symonfy 4: Part 2 In the previous post, we went over how to set up our Symfony 4 project, got a little taste of Twig and created our main home page controller. Today, we’re going to build off of last week’s tutorial and create a login and sign up system for our app! If you aren’t following along from the previous post, I highly recommend it if this is your first time working with Symfony 4. But, if you want to skip ahead to this one, feel free to download the starting source code here. Installing

Continue reading