Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Firebase Authenticationでカスタム認証システムをつかう勘所@Firebase Meetup #13

Firebase Authenticationでカスタム認証システムをつかう勘所@Firebase Meetup #13

認証疎いのですががんばりました

Ef78563ffcf1b94c2fdfc78728be3434?s=128

pochi-sato

May 28, 2019
Tweet

Transcript

  1. Firebase AuthenticationͰ ΧελϜೝূγεςϜΛ ͔ͭ͏צॴ

  2. ࣗݾ঺հ • ͞ͱ͏ɹͨ͘ͱʢΆͪʣ • Ӧۀ→ΤϯδχΞ→ਓࣄ→͍·ʂʂ @pitown https://twitter.com/pitown

  3. ࣗݾ঺հ ࢓ࣄ͸Hotspringͱ͍͏ձࣾͰɺʮζϘϥ ཱྀʯͱ͍͏αʔϏεͳͲɺ ΋ͬͱؾܰʹཱྀߦ΁ߦ͚ΔαʔϏεΛͭ ͍ͬͯ͘·͢ɻ 3ਓ໨ͷΤϯδχΞ͕࠷ۙೖࣾ͠·ͨ͠ʂ

  4. Ͱ͸ຊ୊

  5. Firebase AuthenticationͰ ΧελϜೝূγεςϜΛ ͔ͭ͏צॴ

  6. 2ϓϩδΣΫτͰAuthentication UserΛ Syncͤ͞Δ ʙLINEϩάΠϯΛ࢖ͬͨΧελϜϩάΠ ϯͰ΍Δฤʙ ݩλΠτϧͷ··ߦ͘ͱ LTʹͳΒͳ͍ or ࣗݾຬ଍ ͬΆ͍ͷͰɺ΍Ί·ͨ͠..

  7. 2ϓϩδΣΫτؒͰͷೝূ·ͨ͗ͷ࿩͸ڵຯ͋Δͻͱ ͸͋ͱͰฉ͍͍ͯͩ͘͞ʂ ΧελϜೝূγεςϜΛར༻͢Δ΍ͭͰ͢ɻ ͳ͓ɺ݁ߏͳΨνཁ͕݅ͳ͍ͱɺ 2ϓϩδΣΫτؒͰ·͙ͨͳΜͯɺ ςΫΓ͍͗ͯͯ͢ա౓ͳ࣮૷ʹͳ͍ͬͯΔ ͜ͱ͕ଟ͍ؾ͕͢ΔͷͰɺ·ͣ͸ͦ͜ͷݟ௚͔͠Βɻɻ

  8. Custom Authenticate System

  9. ΧελϜೝূγεςϜ

  10. Firebaseͷೝূ͸ɺ ͘͘͢͢͝͝ศརͰ͢

  11. ͨ͘͞ΜͷϓϩόΠμΛɺ σϑΥϧτͰαϙʔτ͍ͯ͠·͢

  12. None
  13. None
  14. !?

  15. ೔ຊͰར༻཰80%ͷSNS͕ແ͍..

  16. None
  17. ͭ·ΓɺLINEΛར༻ͯ͠ ϩάΠϯ͢Δʹ͸ɺ ΧελϜೝূΛ࢖Θͳ͍ͱ ͍͚ͳ͍ʂ

  18. "VUI 6TFST ᶄpSFCBTFʹαΠϯΠϯɻ 'JSFCBTF6TFSΛऔಘ :PVS "QQMJDBUJPO ͍ΘΏΔϑΣσϨʔγϣϯ*%ϓϩόΠμͳΒ͜͏΍ͬͯɺ 4%,͕͏·͍͜ͱ΍ͬͯ͘ΕΔΠϝʔδͳΜͰ͕͢ɺ 'JSFCBTF $MJFOU

    4%, ᶃΑ͠ͳʹ΍ͬͯ͘ΕΔ
  19. :PVS 4FSWFS "VUI 6TFST ᶈUPLFOͰpSFCBTFʹαΠϯΠϯɻ 'JSFCBTF6TFSΛऔಘ ᶃೝূ ᶅWFSJGZ͢Δ :PVS "QQMJDBUJPO

    ᶄೝূͰಘͨ JE UPLFOΛTFSWFS΁ ᶇ'JSFCBTFUPLFO ΋Β͏ ᶆ$SFBUF -*/&Λ࢖ͬͨΧελϜೝূͩͱ͜͏ -*/&αʔό
  20. ΍΍ͦ͜͠͏͚ͩͲ΍ͬͯΔͷ͸ɺ ᶃLINEͱͷೝূΛߦͬͯɺLINEͷIDɺTokenΛ΋Β͏ ᶄͦΕΒΛݩʹɺFirebase Authenticationʹอଘ͠ʹ͍͘ ͚ͬͯͩͰ͢

  21. άάΕ͹࣮૷ग़ͯ͘ΔͷͰɺ ᶃͷɺ LINEͱ΍ΓऔΓ͢Δ෦෼͸লུʂʂ

  22. :PVS 4FSWFS "VUI 6TFST ᶈUPLFOͰpSFCBTFʹαΠϯΠϯɻ 'JSFCBTF6TFSΛऔಘ ᶃೝূ ᶅWFSJGZ͢Δ :PVS "QQMJDBUJPO

    ᶄೝূͰಘͨ JE UPLFOΛTFSWFS΁ ᶇ'JSFCBTFUPLFO ΋Β͏ ᶆ$SFBUF -*/&αʔό -*/&ଆͰͷೝূΛऴ͑ͯɺࣗલͷαʔόͰWFSJGZ΋ऴ͑ͯɺ ͋͞ɺ-*/&ͷ*%Ͱ'JSFCBTF"VUIFOUJDBUJPOͱབྷΉͧʂ ͱ͍͏ͱ͜Ζ ͚ͩ͜͜આ໌͠·͢
  23. :PVS 4FSWFS "VUI 6TFST ͦ͜ͰԿΛ΍ͬͯΔ͔ͱ͍͏ͱɺ -*/& *% ˞લʹɺ-*/&ଆͰͷ ೝূΛͯ͠ɺ-*/&*% ΛखʹೖΕͨޙͷ૝

    ఆͰ͢
  24. :PVS 4FSWFS "VUI 6TFST ϢʔβʔΛखಈͰ࡞ͬͯΔ͚ͩͰ͢ ͓खखͰϢʔβʔ࡞੒ DSFBUF6TFS -*/& *% ˞લʹɺ-*/&ଆͰͷ

    ೝূΛͯ͠ɺ-*/&*% ΛखʹೖΕͨޙͷ૝ ఆͰ͢ Ϣʔβʔ࡞੒ΛͰ͖Δͷ͸"ENJO4%,͚ͩαʔόαΠυͰ͚ͩɻ ͳͷͰαʔό͕ඞཁͳͷΑͶ
  25. ͜ͷͱ͖ʹɺΩϗϯಉ͜͡ͱΛ͍ͯ͠ΔΜ͚ͩͲɺ ϑΣσϨʔγϣϯʙʙʙͱܾఆతʹҧ͏ͱ͜Ζ͕;ͨͭ͋Δɻ

  26. ϑΣσϨʔγϣϯʙʙʙͩͱ 6TFSQSPWJEFS%BUBQSPWJEFS*Eʹ֨ೲ͞Ε͍ͯΔʂ ᶃ1SPWJEFS͕-*/&͍ͩͬͯ͏͜ͱΛอଘ͢Δઐ༻ͷ৔ॴ͕ͦ΋ͦ΋ͳ͍ɻ ˠطʹϩάΠϯͨ͠ਓΛ୳͢ೝূϓϩόΠμͷείʔϓ͕ߜΕͳ͍

  27. ϑΣσϨʔγϣϯʙʙʙͩͱ 6TFSQSPWJEFS%BUBVJEʹ֨ೲ͞Ε͍ͯΔ ᶄ-*/&ͷ*%Λอଘ͓ͯ͘͠ઐ༻ͷ৔ॴ΋ͦ΋ͦ΋ͳ͍ɻ ˠ-*/&͔ΒૹΒΕ͖ͯͨ6TFS*%Λݟͯ΋ɺͲͷਓ͔ݕࡧ͕Ͱ͖ͳ͍

  28. ཁ͸ɺUserΛͭͬͨ͋͘ͱͰɺ ͥΜͥΜ୳ͤͳ͍ͬ͢

  29. ͦ͜Ͱొ৔͢Δͷ͕ɺFirebase Authentication Userͷuidɻ

  30. 'JSFCBTF$POTPMFͷBVUIFOUJDBUJPOͷϖʔδ ίϨͷ͜ͱɻ

  31. 'JSFCBTF$POTPMFͷBVUIFOUJDBUJPOͷϖʔδ ίϨͷ͜ͱɻ

  32. ͜ͷuidɺΧελϜೝূγεςϜͰ ࢖͏৔߹ɺࣗ༝ʹઃఆͰ͖ΔΘ͚Ͱ͢ (ϑΣσϨʔγϣϯʙʙ͸ϥϯμϜʹͳΔ)

  33. ͦͯ͠ɺ͜ͷuidΛΩʔʹɺ ϢʔβʔΛऔಘ͢Δ͜ͱ΋Ͱ͖ΔΘ͚Ͱ ͢

  34. Ұ൪Լ͕࣮͸MJOFϩάΠϯ -*/&ͰϩάΠϯ (PPHMFͰϩάΠϯ (PPHMFͰϩάΠϯ

  35. Ұ൪Լ͕࣮͸MJOFϩάΠϯ σϑΥͷϓϩόΠμͰ͸ ϥϯμϜจࣈྻͰ Ϣʔβʔੜ੒͞ΕΔ

  36. Ұ൪Լ͕࣮͸MJOFϩάΠϯ ΧελϜϩάΠϯͰ͸ɺ ࣗ෼Ͱࣗ༝ʹͭ͘ΕΔʂ

  37. Ұ൪Լ͕࣮͸MJOFϩάΠϯ MJOFͬͯݟ͑ͯΔ͚Ͳɺ ϢχʔΫʹͳΔΑ͏ʹɺ \1SPWJEFS*E^\1SPWJEFS6TFS*E^ ͷܗͰอଘʂ

  38. ͦΕ͚ͩͰ͢

  39. ͜Ε͕צॴɻ \1SPWJEFS*E^\1SPWJEFS6TFS*E^ ͬͯVJEͰอଘ͢Δ

  40. ίʔυ

  41. ͜ΕΛαʔόͰɺ"ENJO4%,࢖ͬͯ΍Δɻ

  42. ؆୯ʹ·ͱΊΔͱɺ ᶃΧελϜೝূγεςϜΛ࢖͏৔߹͸ɺ1SPWJEFS*Eͱ1SPWJEFS6TFS*E͕ อଘ͞Εͳ͍Α ᶄͳͷͰɺ\1SPWJEFS*E^\1SPWJEFS6TFS*E^ͱ͍͏VJEͰϢʔβʔΛ ͭ͘ΔΑ

  43. ΍Γํͱͯ͠͸ɺ ᶃαʔόΛࣗલͰ༻ҙ͢Δ ͳΜͰ΋ࣗ͝༝ʹ  ᶄαʔόͷ"ENJO4%,Λ͔ͭͬͯϢʔβʔΛͭ͘Δɻ ɹ\1SPWJEFS*E^\1SPWJEFS6TFS*E^ɹͱ͍͏VJEͰͭ͘Δɻ ᶅطଘϢʔβʔΛҾ͖ʹ͍͘ͱ͖΋ɺVJEΛΩʔʹ͢Ε͹Ҿ͚·͢

  44. ͍͞͝ʹิ଍

  45. ͻͱͭɺ͜ͷ΍Γํʹ͸஫ҙ఺͕͋ͬͯɻ ॳճ(PPHMFͰೝূͪ͠Ό͚ͬͨͲɺ ޙ͔Β-*/&ʹೝূϦϯΫ͚͍ͭͨΑɺ ͱ͍͏΋ͷɻ ͦͷ৔߹ɺطʹVJE͕ϥϯμϜจࣈྻͰอଘ͞Ε͍ͯͯɺࠓճͷ΍ΓํΛద༻Ͱ͖ͳ͍ɻ ๻ͷࠓͷཧղͰ͸ɺ'JSFCBTF"VUIFOUJDBUJPOͷอଘྖҬ͸ɺ ɾVJE ΧελϜೝূγεςϜ࣌ͷΈ  ɾDMBJN

    ݖݶͱͯ͠࢖͏ɺσʔλαΠζ্ݶ͋Γ  ɾσϑΥͳ৘ใ FNBJMFNBJM7FSJpFEQIPOF/VNCFSQBTTXPSEEJTQMBZ/BNF QIPUP63-EJTBCMFE  ͷΈͳͷͰɺ֎෦ʹอଘྖҬ͕ඞཁɻ ྫ͑͹ɺNBQQJOHςʔϒϧΈ͍ͨͳ΋ͷΛɺ'JSFTUPSFͷ$PMMFDUJPOʹ࡞ͬͨΓ͢Δඞཁ͕͋ Δɻ ͦ͜·Ͱ΍Γ͍͔ͨ͸࢓༷࣍ୈʜ ͩΕ͔͍͍΍Γํ͋ͬͨΒ͓͍͑ͯͩ͘͠͞
  46. ͓ΘΓ ৘ใަ׵͠·͠ΐ͏ʂ Firestore͜Ε͔Β΍Δͻͱɺ ΍ͬͯΔͻͱɺ ࿩͠·͠ΐ͏ʂ @pitown https://twitter.com/pitown