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
Firebase Authenticationでカスタム認証システムをつかう勘所@Fireba...
Search
pochi-sato
May 28, 2019
Programming
6
2.4k
Firebase Authenticationでカスタム認証システムをつかう勘所@Firebase Meetup #13
認証疎いのですががんばりました
pochi-sato
May 28, 2019
Tweet
Share
More Decks by pochi-sato
See All by pochi-sato
JP_Stripes Deep Dive vol. 6 [Stripe Payment Links]
pochisato
0
76
副業しやすい会社/しにくい会社
pochisato
2
580
LINEでプロダクト検討時に知っててほしい5つの武器
pochisato
0
690
ズボラ旅開発のLINE APIとの歩み
pochisato
0
750
Firestore導入前に検討したかったベスト5@Firebase Meetup #10
pochisato
9
2.2k
Realtime Config with Firestore@Firebase Meetup #8
pochisato
3
550
Other Decks in Programming
See All in Programming
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
170
命名をリントする
chiroruxx
1
390
CSC305 Lecture 26
javiergs
PRO
0
140
testcontainers のススメ
sgash708
1
120
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
200
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
310
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
720
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
370
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
42 best practices for Symfony, a decade later
tucksaun
1
180
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
170
Featured
See All Featured
Making the Leap to Tech Lead
cromwellryan
133
9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
How GitHub (no longer) Works
holman
311
140k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.1k
Optimizing for Happiness
mojombo
376
70k
Site-Speed That Sticks
csswizardry
2
190
GraphQLとの向き合い方2022年版
quramy
44
13k
The Language of Interfaces
destraynor
154
24k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
440
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Transcript
Firebase AuthenticationͰ ΧελϜೝূγεςϜΛ ͔ͭ͏צॴ
ࣗݾհ • ͞ͱ͏ɹͨ͘ͱʢΆͪʣ • Ӧۀ→ΤϯδχΞ→ਓࣄ→͍·ʂʂ @pitown https://twitter.com/pitown
ࣗݾհ ࣄHotspringͱ͍͏ձࣾͰɺʮζϘϥ ཱྀʯͱ͍͏αʔϏεͳͲɺ ͬͱؾܰʹཱྀߦߦ͚ΔαʔϏεΛͭ ͍ͬͯ͘·͢ɻ 3ਓͷΤϯδχΞ͕࠷ۙೖࣾ͠·ͨ͠ʂ
Ͱຊ
Firebase AuthenticationͰ ΧελϜೝূγεςϜΛ ͔ͭ͏צॴ
2ϓϩδΣΫτͰAuthentication UserΛ Syncͤ͞Δ ʙLINEϩάΠϯΛͬͨΧελϜϩάΠ ϯͰΔฤʙ ݩλΠτϧͷ··ߦ͘ͱ LTʹͳΒͳ͍ or ࣗݾຬ ͬΆ͍ͷͰɺΊ·ͨ͠..
2ϓϩδΣΫτؒͰͷೝূ·ͨ͗ͷڵຯ͋Δͻͱ ͋ͱͰฉ͍͍ͯͩ͘͞ʂ ΧελϜೝূγεςϜΛར༻͢ΔͭͰ͢ɻ ͳ͓ɺ݁ߏͳΨνཁ͕݅ͳ͍ͱɺ 2ϓϩδΣΫτؒͰ·͙ͨͳΜͯɺ ςΫΓ͍͗ͯͯ͢աͳ࣮ʹͳ͍ͬͯΔ ͜ͱ͕ଟ͍ؾ͕͢ΔͷͰɺ·ͣͦ͜ͷݟ͔͠Βɻɻ
Custom Authenticate System
ΧελϜೝূγεςϜ
Firebaseͷೝূɺ ͘͘͢͢͝͝ศརͰ͢
ͨ͘͞ΜͷϓϩόΠμΛɺ σϑΥϧτͰαϙʔτ͍ͯ͠·͢
None
None
!?
ຊͰར༻80%ͷSNS͕ແ͍..
None
ͭ·ΓɺLINEΛར༻ͯ͠ ϩάΠϯ͢Δʹɺ ΧελϜೝূΛΘͳ͍ͱ ͍͚ͳ͍ʂ
"VUI 6TFST ᶄpSFCBTFʹαΠϯΠϯɻ 'JSFCBTF6TFSΛऔಘ :PVS "QQMJDBUJPO ͍ΘΏΔϑΣσϨʔγϣϯ*%ϓϩόΠμͳΒ͜͏ͬͯɺ 4%,͕͏·͍͜ͱͬͯ͘ΕΔΠϝʔδͳΜͰ͕͢ɺ 'JSFCBTF $MJFOU
4%, ᶃΑ͠ͳʹͬͯ͘ΕΔ
:PVS 4FSWFS "VUI 6TFST ᶈUPLFOͰpSFCBTFʹαΠϯΠϯɻ 'JSFCBTF6TFSΛऔಘ ᶃೝূ ᶅWFSJGZ͢Δ :PVS "QQMJDBUJPO
ᶄೝূͰಘͨ JE UPLFOΛTFSWFS ᶇ'JSFCBTFUPLFO Β͏ ᶆ$SFBUF -*/&ΛͬͨΧελϜೝূͩͱ͜͏ -*/&αʔό
ͦ͜͠͏͚ͩͲͬͯΔͷɺ ᶃLINEͱͷೝূΛߦͬͯɺLINEͷIDɺTokenΛΒ͏ ᶄͦΕΒΛݩʹɺFirebase Authenticationʹอଘ͠ʹ͍͘ ͚ͬͯͩͰ͢
άάΕ࣮ग़ͯ͘ΔͷͰɺ ᶃͷɺ LINEͱΓऔΓ͢Δ෦লུʂʂ
:PVS 4FSWFS "VUI 6TFST ᶈUPLFOͰpSFCBTFʹαΠϯΠϯɻ 'JSFCBTF6TFSΛऔಘ ᶃೝূ ᶅWFSJGZ͢Δ :PVS "QQMJDBUJPO
ᶄೝূͰಘͨ JE UPLFOΛTFSWFS ᶇ'JSFCBTFUPLFO Β͏ ᶆ$SFBUF -*/&αʔό -*/&ଆͰͷೝূΛऴ͑ͯɺࣗલͷαʔόͰWFSJGZऴ͑ͯɺ ͋͞ɺ-*/&ͷ*%Ͱ'JSFCBTF"VUIFOUJDBUJPOͱབྷΉͧʂ ͱ͍͏ͱ͜Ζ ͚ͩ͜͜આ໌͠·͢
:PVS 4FSWFS "VUI 6TFST ͦ͜ͰԿΛͬͯΔ͔ͱ͍͏ͱɺ -*/& *% ˞લʹɺ-*/&ଆͰͷ ೝূΛͯ͠ɺ-*/&*% ΛखʹೖΕͨޙͷ
ఆͰ͢
:PVS 4FSWFS "VUI 6TFST ϢʔβʔΛखಈͰ࡞ͬͯΔ͚ͩͰ͢ ͓खखͰϢʔβʔ࡞ DSFBUF6TFS -*/& *% ˞લʹɺ-*/&ଆͰͷ
ೝূΛͯ͠ɺ-*/&*% ΛखʹೖΕͨޙͷ ఆͰ͢ Ϣʔβʔ࡞ΛͰ͖Δͷ"ENJO4%,͚ͩαʔόαΠυͰ͚ͩɻ ͳͷͰαʔό͕ඞཁͳͷΑͶ
͜ͷͱ͖ʹɺΩϗϯಉ͜͡ͱΛ͍ͯ͠ΔΜ͚ͩͲɺ ϑΣσϨʔγϣϯʙʙʙͱܾఆతʹҧ͏ͱ͜Ζ͕;ͨͭ͋Δɻ
ϑΣσϨʔγϣϯʙʙʙͩͱ 6TFSQSPWJEFS%BUBQSPWJEFS*Eʹ֨ೲ͞Ε͍ͯΔʂ ᶃ1SPWJEFS͕-*/&͍ͩͬͯ͏͜ͱΛอଘ͢Δઐ༻ͷॴ͕ͦͦͳ͍ɻ ˠطʹϩάΠϯͨ͠ਓΛ୳͢ೝূϓϩόΠμͷείʔϓ͕ߜΕͳ͍
ϑΣσϨʔγϣϯʙʙʙͩͱ 6TFSQSPWJEFS%BUBVJEʹ֨ೲ͞Ε͍ͯΔ ᶄ-*/&ͷ*%Λอଘ͓ͯ͘͠ઐ༻ͷॴͦͦͳ͍ɻ ˠ-*/&͔ΒૹΒΕ͖ͯͨ6TFS*%ΛݟͯɺͲͷਓ͔ݕࡧ͕Ͱ͖ͳ͍
ཁɺUserΛͭͬͨ͋͘ͱͰɺ ͥΜͥΜ୳ͤͳ͍ͬ͢
ͦ͜Ͱొ͢Δͷ͕ɺFirebase Authentication Userͷuidɻ
'JSFCBTF$POTPMFͷBVUIFOUJDBUJPOͷϖʔδ ίϨͷ͜ͱɻ
'JSFCBTF$POTPMFͷBVUIFOUJDBUJPOͷϖʔδ ίϨͷ͜ͱɻ
͜ͷuidɺΧελϜೝূγεςϜͰ ͏߹ɺࣗ༝ʹઃఆͰ͖ΔΘ͚Ͱ͢ (ϑΣσϨʔγϣϯʙʙϥϯμϜʹͳΔ)
ͦͯ͠ɺ͜ͷuidΛΩʔʹɺ ϢʔβʔΛऔಘ͢Δ͜ͱͰ͖ΔΘ͚Ͱ ͢
Ұ൪Լ͕࣮MJOFϩάΠϯ -*/&ͰϩάΠϯ (PPHMFͰϩάΠϯ (PPHMFͰϩάΠϯ
Ұ൪Լ͕࣮MJOFϩάΠϯ σϑΥͷϓϩόΠμͰ ϥϯμϜจࣈྻͰ Ϣʔβʔੜ͞ΕΔ
Ұ൪Լ͕࣮MJOFϩάΠϯ ΧελϜϩάΠϯͰɺ ࣗͰࣗ༝ʹͭ͘ΕΔʂ
Ұ൪Լ͕࣮MJOFϩάΠϯ MJOFͬͯݟ͑ͯΔ͚Ͳɺ ϢχʔΫʹͳΔΑ͏ʹɺ \1SPWJEFS*E^\1SPWJEFS6TFS*E^ ͷܗͰอଘʂ
ͦΕ͚ͩͰ͢
͜Ε͕צॴɻ \1SPWJEFS*E^\1SPWJEFS6TFS*E^ ͬͯVJEͰอଘ͢Δ
ίʔυ
͜ΕΛαʔόͰɺ"ENJO4%,ͬͯΔɻ
؆୯ʹ·ͱΊΔͱɺ ᶃΧελϜೝূγεςϜΛ͏߹ɺ1SPWJEFS*Eͱ1SPWJEFS6TFS*E͕ อଘ͞Εͳ͍Α ᶄͳͷͰɺ\1SPWJEFS*E^\1SPWJEFS6TFS*E^ͱ͍͏VJEͰϢʔβʔΛ ͭ͘ΔΑ
Γํͱͯ͠ɺ ᶃαʔόΛࣗલͰ༻ҙ͢Δ ͳΜͰࣗ͝༝ʹ ᶄαʔόͷ"ENJO4%,Λ͔ͭͬͯϢʔβʔΛͭ͘Δɻ ɹ\1SPWJEFS*E^\1SPWJEFS6TFS*E^ɹͱ͍͏VJEͰͭ͘Δɻ ᶅطଘϢʔβʔΛҾ͖ʹ͍͘ͱ͖ɺVJEΛΩʔʹ͢ΕҾ͚·͢
͍͞͝ʹิ
ͻͱͭɺ͜ͷΓํʹҙ͕͋ͬͯɻ ॳճ(PPHMFͰೝূͪ͠Ό͚ͬͨͲɺ ޙ͔Β-*/&ʹೝূϦϯΫ͚͍ͭͨΑɺ ͱ͍͏ͷɻ ͦͷ߹ɺطʹVJE͕ϥϯμϜจࣈྻͰอଘ͞Ε͍ͯͯɺࠓճͷΓํΛద༻Ͱ͖ͳ͍ɻ ͷࠓͷཧղͰɺ'JSFCBTF"VUIFOUJDBUJPOͷอଘྖҬɺ ɾVJE ΧελϜೝূγεςϜ࣌ͷΈ ɾDMBJN
ݖݶͱͯ͠͏ɺσʔλαΠζ্ݶ͋Γ ɾσϑΥͳใ FNBJMFNBJM7FSJpFEQIPOF/VNCFSQBTTXPSEEJTQMBZ/BNF QIPUP63-EJTBCMFE ͷΈͳͷͰɺ֎෦ʹอଘྖҬ͕ඞཁɻ ྫ͑ɺNBQQJOHςʔϒϧΈ͍ͨͳͷΛɺ'JSFTUPSFͷ$PMMFDUJPOʹ࡞ͬͨΓ͢Δඞཁ͕͋ Δɻ ͦ͜·ͰΓ͍͔༷ͨ࣍ୈʜ ͩΕ͔͍͍Γํ͋ͬͨΒ͓͍͑ͯͩ͘͠͞
͓ΘΓ ใަ͠·͠ΐ͏ʂ Firestore͜Ε͔ΒΔͻͱɺ ͬͯΔͻͱɺ ͠·͠ΐ͏ʂ @pitown https://twitter.com/pitown