Laravel + Auth0 + Stripe でECサイトを作ってみた

Laravel + Auth0 + Stripe でECサイトを作ってみた

Laravel + Auth0 + Stripe でECサイトを作ってみた

02886e95c50822b9aa2552da1e518491?s=128

Takayuki

May 06, 2019
Tweet

Transcript

  1. Laravel Auth0 Laravel Auth0

  2. 3 LaravelͰͷ࣮૷ํ๏ Agenda 2 Auth0ͱ͸ 1 ࣗݾ঺հ 4 Demo

  3. 1 ࣗݾ঺հ

  4. 4 ࣗݾ঺հ ◆໊લ ླ໦ ޹೭(Suzuki Takayuki) ◆ࣗݾ঺հ ɾ1990೥ɺਆಸ઒ݝੜ·Εɻ ɾࣾձਓʹͳ͔ͬͯΒɺϓϩάϥϛϯάΛ࢝ΊΔɻ ɾ2015೥ʹϑϧεϐʔυʹೖࣾ͠ɺ2017೥ʹϑϦʔϥ

    ϯεΛ΍ͬͨޙʹ2017೥11݄ʹԭೄͰىۀɻ ◆झຯ ίεϓϨɺԻָϥΠϒɺϚϥιϯେձʹग़Δɺ໺ٿ؍ ઓ ◆Twitter @kanbo0605
  5. Copyright Re:Build.inc All Rights Reserved. 1.ձࣾ঺հ ◆ձ໊ࣾ גࣜձࣾRe:Build ◆ॅॴ ԭೄݝԭೄࢢதԝ̍ஸ໨̍̒−̕

    ◆ࣄۀ಺༰ ɾࣗࣾWEBαʔϏεͷاըɾ։ൃɻ ɾडୗ։ൃ ◆ࣾһ 5໊ ◆ΤϯδχΞͷಇ͖ํ ϦϞʔτϫʔΫՄೳͳࣗ༝ͳಇ͖ํΛਪ঑ͯ͠·͢ʂ
  6. 2 Auth0ͱ͸

  7. 7 Auth0ͱ͸ ɾ֓ཁ Auth0͸WebΞϓϦ΍ϞόΠϧɺAPIͳͲ ʹରͯ͠ೝূɾೝՄͷαʔϏεΛΫϥ΢υ Ͱఏڙ͍ͯ͠Δɺ͍ΘΏΔIDaaS (Identity as a Service)ϕϯμʔͰ͢ɻ

    ɾΦεεϝͷํ اۀ͕΋ͭWebΞϓϦέʔγϣϯ΍API, Native Mobile AppͳͲͰϢʔβʔೝূ΍ ೝՄɺηΩϡϦςΟΛ૊ΈࠐΈ͍͚ͨΕ Ͳ΋࣮૷͕೉͍͠ɻ https://qiita.com/furuth/items/8826b66a3ec2b2b14222
  8. 8 ֤ݴޠ͝ͱͰνϡʔ τϦΞϧ͕ॆ࣮ͯ͠ ͓Γɺ؆୯ʹಋೖͰ ͖·͢ɻ ओཁͳSNSͱ΄ͱΜͲ࿈ ܞ͓ͯ͠Γɺ࿈ܞํ๏΋ ؆୯ͰศརͰ͢ɻ WebΞϓϦɺSPAΞϓϦωΠ ςΟϒΞϓϦͳͲʹ΋࿈ܞͰ

    ͖ͯɺϢʔβ৘ใΛҰݩ؅ཧ ΋Ͱ͖Δɻ ؆୯ʹಋೖͰ͖Δ ϢʔβೝূΛҰݩ؅ཧͰ ͖Δ ϝϦοτɾಛ௃ ๛෋ͳ࿈ܞઌ 2 ʙϝϦοτʙ 1 3
  9. 9 ๛෋ͳ࿈ܞઌ Auth0ͱ͸

  10. 1 0 ϢʔβΛҰݩ؅ཧ Auth0ͱ͸

  11. 11 ෳ਺ͷσόΠεʹରԠ Auth0ͱ͸

  12. 1 2 ྉۚମܥ https://auth0.com/pricing

  13. 3 LaravelͰͷ࣮૷ํ๏

  14. ΞϓϦέʔγϣϯ ϩάΠϯ͔Βܾࡁ·ͰͷྲྀΕ /index TOPϖʔδ΁ ঎඼ৄࡉϖʔδભҠ ࣌ʹϩάΠϯ ϩάΠϯ੒ޭͨ͠Β ηογϣϯ͸Laravelଆ Ͱ؅ཧ ೝূ

    ܾࡁ ঎඼ߪೖ͔Βܾࡁը໘΁
  15. 1 5 ެࣜͷAuth0ͷLaravelνϡʔτϦΞϧ https://auth0.com/docs/quickstart/webapp/laravel/01-login

  16. 1 6 खॱ ᶃAuth0ͷ؅ཧը໘ͰΞϓϦέʔγϣϯͷઃఆΛߦ͏ɻ ᶄLaravelΛΠϯετʔϧ ᶅcomposer require auth0/login:”~5.0" Λ࣮ߦ ᶆLoginServiceProviderΛઃఆ

    ᶇphp artisan vendor:publishΛ࣮ߦ ᶈ.envΛฤू ᶉroutes/api.phpΛฤू ᶊίϯτϩʔϥΛ࡞੒ ᶋconfig/auth.phpΛฤू ᶌbladeϑΝΠϧΛฤू
  17. 1 7 ᶃAuth0ͷ؅ཧը໘ͰΞϓϦέʔγϣϯͷઃఆΛߦ͏ɻ

  18. 1 8 ᶄLaravelΛΠϯετʔϧ https://readouble.com/laravel/5.5/ja/installation.html

  19. 1 9 ᶅcomposer require auth0/login:”~5.0" Λ࣮ߦ Auth0ϓϥάΠϯΛΠϯετʔϧ Πϯετʔϧ͕׬ྃ͢Δͱɺ2ͭͷϓϥάΠϯ͕௥Ճ͞ΕΔɻ vendor\auth0\auth0-php vendor\auth0\login

  20. 2 0 ᶆLoginServiceProviderΛઃఆ config/app.phpΛฤू ԼهΛ௥Ճ

  21. 2 1 ᶆLoginServiceProviderΛઃఆ AppServiceProvider .phpΛฤू ԼهΛ௥Ճ

  22. 2 2 ᶇphp artisan vendor:publishΛ࣮ߦ ׬ྃ͢Δͱɺconfig/laravel-auth0.php͕࡞੒͞Εɺ σϑΥϧτͷઃఆϑΝΠϧ͕ެ։͞Ε·ͨ͠ɻ

  23. 2 3 ᶈ.envΛฤू ઌ΄Ͳ࡞੒ͨ͠ΞϓϦέʔγϣϯʹهࡌ͞Ε͍ͯΔυϝΠϯ,ID,ύε ϫʔυΛLaravelΞϓϦέʔγϣϯͷ.envʹ௥Ճ͠·͢ɻ

  24. 2 4 ᶉroutes/api.phpΛฤू

  25. 2 5 ᶊίϯτϩʔϥΛ࡞੒

  26. 2 6 ᶋconfig/auth.phpΛฤू ೝূํ๏ΛAuth0ʹมߋ

  27. 2 7 ᶌbladeϑΝΠϧΛฤू

  28. WWW.SITE2MAX.PRO Free PowerPoint & KeyNote Templates 4 DEMO EC Site

    EC Site https://murmuring-tor-53965.herokuapp.com/
  29. 2 9 ࣮ࡍʹಈ͔͢

  30. 3 0 ࣮ࡍʹಈ͔͢

  31. 3 1 ࣮ࡍʹಈ͔͢

  32. 3 2 ࣮ࡍʹಈ͔͢

  33. 3 3 ࣮ࡍʹಈ͔͢

  34. 3 4 ࣮૷ͯ͠Έͨײ૝ ɾ࣮૷͕͘͢͝؆୯ʹͰ͖ͨ(2೔͘Β͍ͰECαΠτ͕׬੒) ɾϩάΠϯϢʔβʹΑͬͯݖݶ෼͚ͨΓͱ͔ɺෳࡶͳ͜ͱ΍ Ζ͏ͱͨ࣌͠ʹগ͠େมͦ͏ɻ ɾҰ౓ɺ࣮૷ͯ͠͠·͑͹ɺSNSͷ࿈ܞઌ૿΍͢ͷ͸Ϙλϯ Λϙνϙν͢Δ͚ͩͰOKʂ

  35. 3 5 ࢀߟ https://qiita.com/furuth/items/8826b66a3ec2b2b14222 https://dev.classmethod.jp/cloud/auth0-overview/ https://www.hypertextcandy.com/laravel-tried-auth0

  36. 3 6 ࠂ஌ https://phpcon.okinawa.jp/ 2019/10/12(౔)ʹԭೄͰPHPΧϯϑΝϨϯεΛ։࠵͠·͢ʂʂʂ ͥͻདྷ͍ͯͩ͘͞ʂ