Recently I was talking all things Front-End development (ES2015, Babel, JSPM, you name it), with a friend, specifically how we should structure his application in order to have a smooth migration to Angular 2 when time comes.
I had an application that heavily relied on the principles outlined by John Papa’s Angular Style Guide, but was also using Redux (a Flux-like state manager library), had some important modifications, conventions, and tools; and throughout this article we will be describing most of them, some of the concepts might be new to you, some might not, feedback is always welcome that’s why I encourage you to leave some on the comments section.
JWT (short for JSON Web Token) is a compact URL-safe means of representing claims to be transferred between two parties, as defined by the standard. It’s usually used for authentication and recently is being favored over the classic cookie scheme in Single Page Applications (SPAs).
Although cookies and server-side authentication are the most established solutions, for APIs usually better alternatives are OAuth2 and JWT.
This post assumes some level of familiarity, but should be easy to follow, visiting the homepage that I linked before should suffice for most of the code samples, if you want me to do a resources recommendation to dig deeper you can check Intridea’s blog post, another one by Toptal (it’s focused on Laravel, but the introductory section it’s worth reading), or if you want to go all the way you check this PluralSight course on OAuth2, OpenID Connect and JWT.