Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Autenticación: Vue.js + JWT
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Ignacio Anaya
November 02, 2017
Programming
0
1.1k
Autenticación: Vue.js + JWT
Esta charla muestra como podemos implementar autenticacion JWT en SPA's desarrolladas con Vue.js
Ignacio Anaya
November 02, 2017
Tweet
Share
More Decks by Ignacio Anaya
See All by Ignacio Anaya
Security is not a feature‼️
ianaya89
2
520
Rompiendo Paradigmas Otra Vuez! 🔨📜3️⃣
ianaya89
0
160
Security is not a feature!
ianaya89
1
390
What's next in Vue 3? 🖖 3️⃣
ianaya89
0
150
What's next in Vue 3? 🖖 3️⃣
ianaya89
0
300
Vue.js, PWA & The Subway Dilemma
ianaya89
0
220
PWA with PWF
ianaya89
0
69
Decentralizing the Web with JavaScript
ianaya89
0
160
hey-devs-time-to-care-about-web-apps-security.pdf
ianaya89
0
130
Other Decks in Programming
See All in Programming
[PHPerKaigi 2026]PHPerKaigi2025の企画CodeGolfが最高すぎて社内で内製して半年運営して得た内製と運営の知見
ikezoemakoto
0
150
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
220
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
130
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
150
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
160
AHC061解説
shun_pi
0
400
「接続」—パフォーマンスチューニングの最後の一手 〜点と点を結ぶ、その一瞬のために〜
kentaroutakeda
3
900
へんな働き方
yusukebe
5
2.6k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
750
AIに任せる範囲を安全に広げるためにやっていること
fukucheee
0
140
エラーログのマスキングの仕組みづくりに役立ったASTの話
kumoichi
0
250
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
Featured
See All Featured
RailsConf 2023
tenderlove
30
1.4k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
86
The Language of Interfaces
destraynor
162
26k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
The Cult of Friendly URLs
andyhume
79
6.8k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Are puppies a ranking factor?
jonoalderson
1
3.1k
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
230
Bash Introduction
62gerente
615
210k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
240
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.2k
Transcript
Autenticación: Vue.js + JWT { Autenticación: Vue.js + JWT }
- @ianaya89 1
Ignacio Anaya @ianaya89 > Full Stack Developer, Tech Trainer &
Speaker > Embajador @Auth0 > Organizador @Vuenos_Aires { Autenticación: Vue.js + JWT } - @ianaya89 2
! Por Qué Token? — Sin Estado — Desacoplado —
Escalable { Autenticación: Vue.js + JWT } - @ianaya89 3
{ Autenticación: Vue.js + JWT } - @ianaya89 4
! Por Qué JWT? — Estandard — Seguro — Auto
Contenido — JSON ! { Autenticación: Vue.js + JWT } - @ianaya89 5
! JWT { Autenticación: Vue.js + JWT } - @ianaya89
6
! JWT ! Header { "alg": "HS256", "typ": "JWT" }
{ Autenticación: Vue.js + JWT } - @ianaya89 7
! JWT ! Payload { "sub": "1234567890", "name": "John Doe",
"admin": true, "iss": "https://api.com" } { Autenticación: Vue.js + JWT } - @ianaya89 8
! JWT ✍ Signature HMACSHA256( base64UrlEncode(header) + "." + base64UrlEncode(payload),
secret ) { Autenticación: Vue.js + JWT } - @ianaya89 9
! JWT ! Caso de Uso — SPA's — Serverless
— API's — Mobile — IoT { Autenticación: Vue.js + JWT } - @ianaya89 10
{ Autenticación: Vue.js + JWT } - @ianaya89 11
! Herramientias — Auth API — vue-router — trae (http
library) — localStorage { Autenticación: Vue.js + JWT } - @ianaya89 12
Auth Servidor = Seguridad Auth Cliente = UX { Autenticación:
Vue.js + JWT } - @ianaya89 13
! Auth API — Obtener JWT — Validar JWT —
node, express, jsonwebtoken, express-jwt { Autenticación: Vue.js + JWT } - @ianaya89 14
! vue-router — SPA's — 1 route = 1 component
{ Autenticación: Vue.js + JWT } - @ianaya89 15
! vue-router Routes Meta const router = new Router({ routes:
[{ path: '/', component: Home }, { path: '/login', component: Login, meta: { isPublic: true } }] }) { Autenticación: Vue.js + JWT } - @ianaya89 16
! vue-router Guardian Navs router.beforeEach((to, from, next) => { //
resolver si el usuario esta logueado if (!to.meta.isPublic && !isAuthenticated()) { return next('login') } next() }) { Autenticación: Vue.js + JWT } - @ianaya89 17
! trae — Libreria HTTP — Fetch Wrapper (con esteroides)
— Similar axios — Usa Promises { Autenticación: Vue.js + JWT } - @ianaya89 18
! trae Ejemplo import trae from 'trae' trae.baseUrl('http://api:com') trae.get('/', {})
.then(res => console.log(res.data)) .catch(err => console.log('[ERROR]', err)) { Autenticación: Vue.js + JWT } - @ianaya89 19
! trae Middlewares trae.before((config) => { const token = '123456789'
config.headers['Authentication'] = token return config }) { Autenticación: Vue.js + JWT } - @ianaya89 20
! localStorage trae.post('/auth', { email, password }) .then(res => {
localStorage.token = res.data localStorage.user = atob(res.data.split('.')[1]) }) .catch(err => console.log('[ERROR]', err)) { Autenticación: Vue.js + JWT } - @ianaya89 21
! Demo — API — Web App { Autenticación: Vue.js
+ JWT } - @ianaya89 22
! Más! — jwt.io — Auth0 — jwt-handbook — trae
— vue-router { Autenticación: Vue.js + JWT } - @ianaya89 23
Preguntas? { Autenticación: Vue.js + JWT } - @ianaya89 24
! Gracias! @ianaya89 { Autenticación: Vue.js + JWT } -
@ianaya89 25