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

Cognito User Poolsと仲良くなるための話 / cognito-user-pools

Cognito User Poolsと仲良くなるための話 / cognito-user-pools

Cognitoと仲良くなるためにAmplifyはいいぞ!という話をしました。

6b7ca499772f1ea867f6133778c77bbe?s=128

Takahiro Tsuchiya

May 28, 2019
Tweet

Transcript

  1. $PHOJUP6TFS1PPMT ͱ஥ྑ͘ͳΔͨΊͷ࿩ +"846(໊ݹ԰ೝূษڧձ ʢՐʣ 5BLBIJSP5TVDIJZB!DPSPDO

  2. 5BLBIJSP5TVDIJZB ͜ΖͪΌΜ !DPSPDO
 
 $PEF਌ࢠ%FW0QTܥαʔϏε͕޷͖Ͱ͢

  3. ࣗݾ঺հ w ذෞݝࡏॅͷϑϧϦϞʔτϫʔΧʔ w גࣜձࣾΩϟελʔͰCPTZVΛ։ൃ w 3VCZPO3BJMTɺ7VFKTɺ"84ɺೝূٕज़ w ίϛϡχςΟɾษڧձొஃ w

    /BHPZB'SPOUFOE6TFS(SPVQ w +"846(໊ݹ԰ w "VUI"NCBTTBEPS$PNNVOJUZ-FBEFST w *EFOUJUZ%BODF4DIPPMʢٕज़ॻయͷ࿩ʣ w ໊ݹ԰3VCZձٞʢύεϫʔυϨεೝূͷ࿩ʣ
  4. $PHOJUPͱͷग़ձ͍ w αʔϏε։ൃͰαοͱ࢖͑Δ*%BB4Λ୳͍ͯͨ͠ w "NQMJGZ͕ൃද͞Εͨ͜Ζʢޙ൒ʁʣ w ͪΐΖͬͱΞΫηε੍ޚ͔͚ͨͬͨͩ͠ w ߏ੒ෳࡶͰཧղͰ͖ͣϋʔυϧ͕ߴͯ͘࠳ં w

    ͦͷޙ"VUIʹग़ձ͏ w "VUIʹࠢΛചΔ w ຊۀҎ֎Ͱ$PHOJUP࢖͏ػձ͕ʂ ?P?
  5. $PHOJUP
 ׬શʹཧղͨ͠

  6. IUUQTUPHFUUFSDPNMJ

  7. ΋ͬͱৄ͘͠ͳΓ͍ͨʂ

  8. ࠓ೔ͷ࿩ w 8FCΞϓϦ։ൃͷίϯςΩετߴΊ w "DUJWF%JSFDUPSZͷ࿩͸͠·ͤΜ w $PHOJUPͷػೳΛ੔ཧ w "NQMJGZͱҰॹʹ࢖͏ͱ஥ྑ͘ͳΕͦ͏ w

    ஥ྑ͘ͳΔͨΊͷπʔϧ঺հ w ࣌ؒ͋Ε͹5JQTͱ͔
  9. $PHOJUPͷػೳ w "84͕ఏڙ͢ΔೝূೝՄαʔϏε w $PHOJUP'FEFSBUFE*EFOUJUZʢ*%ϓʔϧʣ w *E1ʢ*EFOUJUZ1SPWJEFSʣʹରͯ͠454Λ෷͍ग़͢ w *E1'BDFCPPL (PPHMF

    $PHOJUP6TFS1PPMTͳͲ w $PHOJUP6TFS1PPMTʢϢʔβʔϓʔϧʣ w "84͕ఏڙ͢Δ*E1ɺϢʔβʔొ࿥ɾೝূɾ؅ཧ w ֎෦*E1ͱಉྻػೳʹҐஔ͢Δ w $PHOJUP4ZOD w σʔλͷσόΠεؒಉظ
  10. https://docs.aws.amazon.com/ja_jp/cognito/latest/ developerguide/cognito-scenarios.html

  11. ೝূํࣜ w 431ʢ4FDVSF3FNPUF1BTTXPSEʣ w ΫϥΠΞϯτͱ$PHOJUP͕௚઀௨৴͢Δ w ωοτϫʔΫܦ༝Ͱύεϫʔυ͕ૹ৴͞Εͳ ͍
 


  12. ΞϓϦΫϥΠΞϯτઃఆ w ΫϥΠΞϯτೝূͷ৔߹͸ʜ
 ˠγʔΫϨοτ͸ෆཁͳͷͰੜ੒ͪ͠ΌͩΊ

  13. 0"VUI w 1,$&ʢ1SPPG,FZGPS$PEF&YDIBOHFCZ0"VUI1VCMJD$MJFOUTʣ ʹະର ԠͳͷͰϞόΠϧΞϓϦೝূͩͱݫ͍͠ w *NQMJDJUHSBOU͸ઈର࢖Θͳ͍ʢ੬ऑʣ w 431Ͱ֤छτʔΫϯ͕औಘͰ͖ΔͷͰ͋͑ͯ0"VUI ࢖͏ඞཁͳͦ͞͏

  14. ͦͷଞͷϢʔεέʔε w αʔόʔϕʔεͰೝূ͍ͨ͠ w "%.*/@/0@431@"65) w ΧελϜೝূ࢖͍͍ͨʢ-BNCEBʣ w $6450.@"65)@'-08@0/-: w

    ϢʔβʔҠߦ͍ͨ͠ w 64&3@1"44803%@"65)
  15. ݁ہͲΕ࢖͑͹͍͍ͷʁ w 8FCϞόΠϧΞϓϦͰαʔόʔϨε͍ͨ͠ w 431ͰΫϥΠΞϯτೝূҰ୒ w ఻౷తͳαʔόʔ͋Γͷ8FCγεςϜ w ϩάΠϯΤϯυϙΠϯτ࣮૷ͯ͠αʔόʔϕʔεೝূ w

    MPHJO΁Ϣʔβʔ໊ͱύεϫʔυ౤͛Δ w αʔόʔܦ༝Ͱ"ENJO*OJUJBUF"VUI"1*Λୟ͍ͯೝূͯ͠ ηογϣϯΛཱ֬͢ΔΑ͏ͳύλʔϯ͸ͬͪ͜ w $PHOJUPͷྑ͕ࣦ͞ΘΕΔͷͰ͸ײ͕एׯ
  16. "NQMJGZ

  17. "NQMJGZ w $PHOJUPͷ+BWB4DSJQU4%,Λ௚઀ѻ͏ͱ ΞϓϦଆͷ࣮૷͕एׯ໘౗ w 6*΋ࣗ෼Ͱ࡞Βͳ͖Ό͍͚ͳ͍ w "NQMJGZͷϨʔϧʹ৐Δ͜ͱͰඇৗʹ؆୯ʹ ೝূը໘ΛߏஙͰ͖Δ w

    5ZQF4DSJQUରԠࡁ w ஥ྑ͘ͳΕͦ͏ͳ༧ײ
  18. "NQMJGZͬͯԿ͚ͩͬ w 8FCʢ41"ʣϞόΠϧΞϓϦΛߴ଎ʹߏங͢ΔͨΊͷπʔϧ܈ w "NQMJGZKT.PCJMF༻4%,ɹˡࠓճ͸γϯϓϧʹ͚ͩ͜͜࢖͏ w ΫϥΠΞϯτ૊ΈࠐΈ༻ϥΠϒϥϦ w "NQMJGZ$-* w

    ίϚϯυϥΠϯܦ༝Ͱ"84ͷ֤छαʔϏεͷઃఆ͕Ͱ͖Δ w $MPVE'PSNBUJPOΛར༻͍ͯ͠Δ w "NQMJGZ$POTPMF w (JUͷมߋΛτϦΨʔͱͨ͠੩తαΠτͷര଎ެ։αʔϏε w /FUMJGZͷ"84൛ɺ(JU-BCରԠͳͲɺ୺຤͝ͱͷදࣔνΣοΫ w ೝূ͚ͩͰͳͯ͘4΍"QQ4ZODͳͲɺαʔόʔϨεͰҰ௨Γಈ͘ΞϓϦΛ࡞ ΔͨΊͷ؀ڥͰɺ(PPHMFͷ'JSFCBTFΛҙ͍ࣝͯ͠Δɻ
  19. BNB[PODPHOJUPJEFOUJUZKT w $PHOJUPͷ+BWB4DSJQU4%,͸"NQMJGZKTͷ ϦϙδτϦ഑ԼʹҠಈͨ͠ w "84ʮΫϥΠΞϯταΠυ͸"NQMJGZ࢖ͬͯͶʯ

  20. "NQMJGZ ೝূΛ஌Δ w IUUQTBXTBNQMJGZHJUIVCJPEPDT KTBVUIFOUJDBUJPO͕ࢀߟʹͳΔ w ೝূʹؔ͢Δ৘ใ͕ඇৗʹॆ࣮͍ͯ͠Δ w "NQMJGZ"VUI͕෼͔Ε͹ྑͦ͞͏
 


    
 
 

  21. "NQMJGZ $PHOJUPͷ͍͍ͱ͜Ζ w 3FBDU 7VF "OHVMBSͰ࢖͑Δ6*෇͖ೝূϥΠϒϥ Ϧ͕ఏڙ͞Ε͍ͯΔ w ೝূ࣌ʹඞཁͳը໘͕Ұ௨Γ໢ཏ͞Ε࣮ͯ૷͞Ε͍ͯΔ w

    4JHO*O $POpSN4JHO*O 4JHO6Q  $POpSN4JHO6Q 'PSHPU1BTTXPSE w ͍ͭ͜Λ૊ΈࠐΊ͹ҰॠͰ࣮૷͕ऴΘΔ w BNQMJGZBVUIFOUJDBUPSλάΛஔ͚ͩ͘ w $PHOJUP࢖ͬͨϓϩτλΠϓ։ൃͱ͔ϝονϟૣ͍ͱࢥ͏
  22. None
  23. ݸਓతʹخ͍͠ͱࢥͬͨϙΠϯτʢ7VFKTʣ w &WFOU#VTʹରԠ͍ͯ͠ΔͷͰը໘ભҠͷ੍ ޚ͕ඇৗʹָ w Ϣʔβʔొ࿥ˠݕূίʔυೖྗͳͲͷը໘ભ Ҡͱ41"ͷϧʔςΟϯάܨ͗ࠐΈ͕͍͍ײ͡ ʹ੍ޚͰ͖Δ w ΧελϜσβΠϯʹ΋ରԠ͍ͯ͠Δ

    w ͔ͳΓυΩϡϝϯτஸೡ
  24. "NQMJGZܦ༝ͰऔಘͰ͖ΔτʔΫϯ w "NQMJGZͰೝূΛ͢Δͱෳ਺ͷτʔΫϯΛऔಘͰ͖Δ w ೝূޙMPDBM4UPSBHFʹࣗಈͰ֨ೲ͞ΕΔʢʂʣ w JE5PLFOʢೝূτʔΫϯʣ w ࣗલͷ"1*αʔόʔΛೝূͨ͠ΓɺΧελϜΦʔιϥΠβʔ࢖͏৔߹ w

    BDDFTT5PLFOʢೝՄτʔΫϯʣ w *EFOUJUZ1PPMT΁ͷΞΫηεͯ͠454Λ෷͍ग़ͨ͢Ί w SFGSFTI5PLFO w τʔΫϯߋ৽༻ʢBDDFTTʣ
  25. https://docs.aws.amazon.com/ja_jp/cognito/latest/ developerguide/cognito-scenarios.html

  26. None
  27. τʔΫϯ͸+85ܗࣜ w FZ+Ͱ࢝·ΔτʔΫϯ͸+40/8FC5PLFO w +40/Λ#BTFΤϯίʔυͯ͠࿈݁ͨ͠΋ͷ w IFBEFSQBZMPBETJHOBUVSF w QBZMPBE෦෼ʹϢʔβʔ৘ใ͕֨ೲ͞Ε͍ͯΔ w

    ॺ໊͕͋ΔͷͰվ͟Μͷ֬ೝ͕Ͱ͖Δ w IUUQTKXUJPʹషΓ෇͚Δͱத਎͕ݟ͑Δ w FZ+Λݟ͚ͭͨΒͥͻ೷͍ͯΈ·͠ΐ͏ w SFGSFTI5PLFO͸҉߸Խ͞Εͯͯதݟ͑ͳ͔ͬͨ
  28. τʔΫϯͷܗࣜ͸+85 w FZ+Ͱ࢝·ΔτʔΫϯ͸σίʔυͰ͖Δ w KXUJPͳͲͰ TVC͕DPHOJUPͷ66*%

  29. ϩάΠϯঢ়ଶͷ൑ఆ w ΞϓϦଆͰϩάΠϯͯ͠Δ͔൑ఆ͍ͨ͠৔߹ w ϩάΠϯத༗ޮͳτʔΫϯΛอ༗͍ͯ͠Δ w ΫϥΠΞϯτ͔͠஌Γ͑ͳ͍ w "VUIDVSSFOU4FTTJPO Ͱ൑ఆ͢Δ

  30. ࣗલαʔόʔͷೝূʹ࢖͏ $PHOJUP͔Βൃߦ ͞Ε͍ͯΔެ։伴Ͱ+85 ͷॺ໊Λݕূ ֨ೲ৔ॴ͸ཁݕ౼
 ݱঢ়MPDBM4UPSBHF͸ةͳ͍ͷͰ IUUQ0OMZͳTFTTJPO͕ϕλʔ

  31. +40/8FC,FZ w IUUQTDPHOJUPJEQBQOPSUIFBTUBNB[POBXTDPNBQ OPSUIFBTU@999999999XFMMLOPXOKXLTKTPO͔Β+85Λݕ ূ͢ΔͨΊͷެ։ݤ͕औಘͰ͖Δʢ99999͸6TFS1PPM*Eʣ w +85ͷIFBEFSͷLJEͱରԠ͠ ͯΔ伴Λ࢖͏

  32. $PHOJUP7JFXFS w ݕূਐ·ͳ͍ˠ֬ೝπʔϧ࡞ͬͨ w ໭Γ஋ͱ͔τʔΫϯͷத਎Λ֬ೝ͢Δͷ໘౗ w ΫϥΠΞϯτଆ͕ͳ͍ͱಈ͖෼͔ΒΜ w ઃఆ͕ؒҧͬͯΔͷ͔࣮૷͕ؒҧͬͯΔͷ͔ w

    ϢʔβʔμογϡϘʔυͱ"EN*OJUJBUF"VUIͰ࡞ͬͨ ϢʔβʔΛೝূࡁΈʹ͢ΔػೳΛ͚͍ͭͨ w IUUQTHJUIVCDPNDPSPDODPHOJUPWJFXFS w ˞ಈ͔ͨ͢Ίʹ*EFOUJUZ1PPMͷ࡞੒΋ඞཁ
  33. None
  34. None
  35. %&.0 ʢ࣌ؒͳ͚Ε͹࠷ޙͰʣ

  36. "NQMJGZͰ஫ҙ͍ͨ͠ͱ͜Ζ w τʔΫϯͷ༗ޮظݶΛࢦఆͰ͖ͳ͍ w τʔΫϯͷอଘઌ͕MPDBM4UPSBHF w τʔΫϯͷߋ৽Λ੍ޚͰ͖ͳ͍ʢࣗಈߋ৽ʣ

  37. τʔΫϯͷ༗ޮظݶΛࢦఆͰ͖ͳ͍ w JE5PLFONJO w BDDFTT5PLFONJO w SFGSFTI5PLFOEBZT w τʔΫϯ͕࿙Εͨ࣌Λߟྀͯ͠ՄೳͳݶΓ୹͍ ࣌ؒʹઃఆ͍ͨ͠

    w ͦ΋ͦ΋JE BDDFTT5PLFO͸࿙ΕΔલఏͰ ઃܭ͢Δඞཁ͕͋Δ
  38. τʔΫϯͷอଘઌ͕MPDBM4UPSBHF w BDDFTT5PLFO͸·ͩ͠΋SFGSFTI5PLFOͷΑ͏ͳੜଘظ͕ؒ௕ ͍τʔΫϯΛϒϥ΢βʹอଘͯ͠͠·͍ͬͯΔ w 944ͰͿͬ͜ൈ͔ΕΔͷͰɺ֎෦+4ಡΉ࣌஫ҙɻಛʹ޿ࠂͱ͔ɻ w IUUQ0OMZDPPLJF͸ະαϙʔτ w IUUQTHJUIVCDPNBXTBNQMJGZBNQMJGZKT

    JTTVFT w ϞόΠϧͱҟͳΓɺ8FC͸ηΩϡΞʹอଘͰ͖Δ৔ॴ͕ͳ͍ w ϒϥ΢βʹอଘͤͣJONFNPSZͰ΍Γ͍ͨ w $PHOJUPͱηογϣϯషΕΔػೳ͕͜ͳ͍ͱ೉ͦ͠͏
  39. τʔΫϯͷߋ৽Λ੍ޚͰ͖ͳ͍ w τʔΫϯͷ༗ޮظݶ͕੾ΕͨޙͷॳճΞΫηεͰࣗಈͰ৽͍͠ τʔΫϯʹߋ৽͞ΕΔ w خ͍͠൒໘ɾɾɾ w ΫϥΠΞϯτͰτʔΫϯͷ༗ޮظݶ0,ˠϦΫΤετ࣌ࠩͰ αʔόʔଆݕূ࣌ʹ༗ޮظݶ/(ͷ৔߹͕ൃੜ͢Δ w

    ΫϥΠΞϯτଆͰૣΊʹτʔΫϯΛߋ৽͓͖͍ͯͨ͠PSαʔ όʔଆͰ༗ޮظݶͷΏͱΓʢMFFXBZʣΛ΋ͨͤΔඞཁ͕ͰΔ w αʔόʔଆʹΏͱΓΛ΋ͨͤΔͷਪ঑Β͍͠ w ʢͲ͔͜ͷJTTVFͰٞ࿦͞Ε͚ͯͨͲݟ͔ͭΒͳ͍ʣ
  40. ॅΈ෼͚େࣄ w "84ͰαʔόʔϨε
 ˠ$PHOJUP "NQMJGZ w ($1ͰαʔόʔϨε
 ˠ'JSFCBTF w αʔόʔ͕͋ΔηΩϡϦςΟཁ݅ݫ͍͠


    ˠ"VUI
  41. ·ͱΊ w 8FCΞϓϦ։ൃͰͷೝূͷ࿩Λͨ͠ w "NQMJGZ࢖͏ͱ$PHOJUPͱ஥ྑ͘ͳΕ·͢ w +85࢖ͬͨೝূͷ࢓૊ΈΛ཈͓͑ͯ͘͜ͱ w ηΩϡϦςΟपΓͷཁ݅஫ҙʢಛʹ8FCʣ w

    "84ͷαʔϏεʹݻࣥͤͣॊೈͳબ୒Λ w ࠓޙͷΞοϓσʔτͰԽ͚ͦ͏