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
570
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
540
Other Decks in Programming
See All in Programming
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
340
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
920
みんなでプロポーザルを書いてみた
yuriko1211
0
260
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
540
Outline View in SwiftUI
1024jp
1
330
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
110
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
680
Kaigi on Rails 2024 〜運営の裏側〜
krpk1900
1
220
イベント駆動で成長して委員会
happymana
1
320
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
CSC509 Lecture 12
javiergs
PRO
0
160
Featured
See All Featured
Scaling GitHub
holman
458
140k
Speed Design
sergeychernyshev
25
620
It's Worth the Effort
3n
183
27k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Adopting Sorbet at Scale
ufuk
73
9.1k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Facilitating Awesome Meetings
lara
50
6.1k
Producing Creativity
orderedlist
PRO
341
39k
A better future with KSS
kneath
238
17k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Making Projects Easy
brettharned
115
5.9k
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