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
140
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
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.9k
CSC307 Lecture 09
javiergs
PRO
1
840
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
380
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
230
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
6
630
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
Best-Practices-for-Cortex-Analyst-and-AI-Agent
ryotaroikeda
1
110
Apache Iceberg V3 and migration to V3
tomtanaka
0
170
並行開発のためのコードレビュー
miyukiw
0
1.1k
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
4k
CSC307 Lecture 04
javiergs
PRO
0
660
Featured
See All Featured
Scaling GitHub
holman
464
140k
Deep Space Network (abreviated)
tonyrice
0
64
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
64
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
170
Java REST API Framework Comparison - PWX 2021
mraible
34
9.1k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.6k
sira's awesome portfolio website redesign presentation
elsirapls
0
150
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
98
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
290
Into the Great Unknown - MozCon
thekraken
40
2.3k
Code Reviewing Like a Champion
maltzj
527
40k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
110
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