Sign Up / In with Google! | SvelteKit OAuth 2.0

Consulting Ninja May 30, 2023
Video Thumbnail
Consulting Ninja Logo

Consulting Ninja

View Channel

About

I am here to help as MANY others as possible with web development, software development, and consulting related obstacles and issues. I love development, technology, consulting and want to build a positive community of developers (front, back , middle, scripts, everyone!) and tech lovers helping each other and building each other up to become better! I hope to see you soon! My channel membership is live now you can check that out here: https://www.youtube.com/channel/UCwPrPv9eS7Xgfp_wi7uxt0g/join I hope to see you in one of my live stream meet ups! * FYI * No StackOverflow behavior will be tolerated in my channel. Give positive advice and clear feedback without talking down to those that don't know please.

Video Description

In this video I show how to setup your Google Developer Console to create an OAuth 2.0 consent screen and OAuth2 client id credentials to allow signing in with Google. I then show where to get the official google-auth-library for creating the initializing url and verifying tokens and extracting credentials. After that I show how to setup a SvelteKit form action to start the request and a SvelteKit GET end point to process the request back from Google! I hope that you find this helpful! My channel membership is live check it out here!: https://www.youtube.com/channel/UCwPrPv9eS7Xgfp_wi7uxt0g/join Membership perk video: https://youtu.be/FJgKifAThdU *Note* Save yourself the headache and do NOT attempt to have a different a separate origin URI from your redirect URI : i.e. do NOT initiate the request from origin URI localhost:5173 and then try to receive the redirect URI on 127.0.0.1:3000. Google will not send the code it will send a csrf token that you need an additional package and TONS of work (they rotate the keys) to pull out and verify! OAuth2Client docs here: https://cloud.google.com/nodejs/docs/reference/google-auth-library/latest/google-auth-library/oauth2client Need help? visit https://www.consultingninja.tech Check out my channel @ConsultingNinja for more videos like these. Requirements when using Google Sign in Docs: https://developers.google.com/identity/branding-guidelines Source Code Available Here: https://github.com/consultingninja/kitAuth 00:00 - Intro 01:16 - Google Console Setup 06:19 - SvelteKit ENV Setup 07:10 - Google Auth Library 07:26 - SvelteKit Overview 07:52 - SvelteKit Code 18:32 - Wrap-Up *post release update* Googles Documentation is not great and you should play around a bit with opening different pieces of this to see what is inside. As an example: One place in Googles docs said that the field "id_token" only had 4 properties and none of them very useful. However after opening with const ticket = await oAuth2Client.verifyIdToken({idToken: id_token,audience:process.env.CLIENT_ID,}); I found this contained all user information as well. I have found other instances of Googles docs being misleading and or inaccurate. Just a note!

You May Also Like

Craft Essentials for Your Home

AI-recommended products based on this video

Loading...
Paper Cats Origami Kit, 50pcs DIY 3D Origami Animal Kit for Create Adorable Paper Cats, Creative Craft Activity for Cat Lovers, Fun Home Desk Decor, Christmas Birthday Gift(Cat)

Paper Cats Origami Kit, 50pcs DIY 3D Origami Animal Kit for Create Adorable Paper Cats, Creative Craft Activity for Cat Lovers, Fun Home Desk Decor, Christmas Birthday Gift(Cat)

(3)
$12.99
FREE delivery Fri, Dec 5 on your first order
700+ bought in past month
Loading...
Art Kit, 272 Pack Art Set Drawing Kit for Kids Girls Boys, Deluxe Gift Art Supplies with Trifold Easel, Origami Paper, Coloring Pad, Sketch Pad, Pastels, Crayons, Pencils, Watercolors (Pink)
Best Seller

Art Kit, 272 Pack Art Set Drawing Kit for Kids Girls Boys, Deluxe Gift Art Supplies with Trifold Easel, Origami Paper, Coloring Pad, Sketch Pad, Pastels, Crayons, Pencils, Watercolors (Pink)

(422)
$29.99
FREE delivery Sat, Jun 14 on your first order
200+ bought in past month
Loading...
Christmas Wrapping Paper Sheets 67 Number Santa Hat Print White Gift Wrap for Presents DIY Crafts Three Sizes 18 x 20 30 x 20 30 x 70 Inch (A, 30X70inch)

Christmas Wrapping Paper Sheets 67 Number Santa Hat Print White Gift Wrap for Presents DIY Crafts Three Sizes 18 x 20 30 x 20 30 x 70 Inch (A, 30X70inch)

(4)
$12.49
$1.99 delivery Nov 20 - 24
Loading...
Hotouch Women's T Shirts Roll-up Short Sleeve V Neck Tees Fashion Tops Trendy Basic Soft Casual Summer Tshirt

Hotouch Women's T Shirts Roll-up Short Sleeve V Neck Tees Fashion Tops Trendy Basic Soft Casual Summer Tshirt

(400)
$24.99
FREE delivery Thu, Sep 4 on your first order
Loading...
PJ PAUL JONES Men's Dress Shirts Long Sleeves Buttons Down Basic Business Shirts

PJ PAUL JONES Men's Dress Shirts Long Sleeves Buttons Down Basic Business Shirts

(525)
$37.99
FREE delivery Sun, Aug 10
50+ bought in past month
Loading...
BIBURY Multitool Pliers BI2038B, 22-in-1 Stainless Steel Multi Tool with Flint, Window Breaker, Scissors, Back Clip, Folding Pocket Multifunctional Self-locking EDC Tool for Survival Camping Hiking

BIBURY Multitool Pliers BI2038B, 22-in-1 Stainless Steel Multi Tool with Flint, Window Breaker, Scissors, Back Clip, Folding Pocket Multifunctional Self-locking EDC Tool for Survival Camping Hiking

(1,240)
$55.99
FREE delivery Thu, Jun 19
Loading...
3PCS Dog Grooming Scissors kit Thinning Shears Scissors Curved Scissor Comb Stainless Steel Pet Cat Dog Grooming for Dogs Cats Pets Professional Straight Scissor Comb

3PCS Dog Grooming Scissors kit Thinning Shears Scissors Curved Scissor Comb Stainless Steel Pet Cat Dog Grooming for Dogs Cats Pets Professional Straight Scissor Comb

(0)
$9.96
FREE delivery Thu, Sep 11 on your first order
Loading...
RoverTac Multitool Pocket Knife Tactical Camping Survival Knife Gifts for Men Dad Husband 18 in 1 Multi Tool Knife Pliers Scissors Saw Corkscrew 9-Pack Screwdrivers with Safety Lock and Nylon Sheath

RoverTac Multitool Pocket Knife Tactical Camping Survival Knife Gifts for Men Dad Husband 18 in 1 Multi Tool Knife Pliers Scissors Saw Corkscrew 9-Pack Screwdrivers with Safety Lock and Nylon Sheath

(1,514)
$32.39
FREE delivery Thu, Jun 19 on your first order
200+ bought in past month
Loading...
Paper Cats Origami Kit, 50pcs DIY 3D Origami Animal Kit for Create Adorable Paper Cats, Creative Craft Activity for Cat Lovers, Fun Home Desk Decor, Christmas Birthday Gift(Cat)

Paper Cats Origami Kit, 50pcs DIY 3D Origami Animal Kit for Create Adorable Paper Cats, Creative Craft Activity for Cat Lovers, Fun Home Desk Decor, Christmas Birthday Gift(Cat)

(3)
$12.99
FREE delivery Fri, Dec 5 on your first order
700+ bought in past month
Loading...
Christmas Wrapping Paper Sheets 67 Number Santa Hat Print White Gift Wrap for Presents DIY Crafts Three Sizes 18 x 20 30 x 20 30 x 70 Inch (A, 30X70inch)

Christmas Wrapping Paper Sheets 67 Number Santa Hat Print White Gift Wrap for Presents DIY Crafts Three Sizes 18 x 20 30 x 20 30 x 70 Inch (A, 30X70inch)

(4)
$12.49
$1.99 delivery Nov 20 - 24
Loading...
LEGO Icons Williams Racing FW14B & Nigel Mansell F1 Model Car Kit - Building Set for Adults, Ages 18+ - F1 DIY Craft for Display - Gift Idea for Fans of F1-10353

LEGO Icons Williams Racing FW14B & Nigel Mansell F1 Model Car Kit - Building Set for Adults, Ages 18+ - F1 DIY Craft for Display - Gift Idea for Fans of F1-10353

(40)
$89.99
PrimeFREE delivery Sat, Jun 14
200+ bought in past month
Loading...
Koolmox Koolmox Canvas Grocery Bag, 6-Pack 22'' Large Bags with Reinforced Handles, 12 Oz Heavy Duty Reusable Washable Grocery Shopping Bags Plain Bags for Teacher Paint Embroidery Draw DIY Art Craft Totes

Koolmox Koolmox Canvas Grocery Bag, 6-Pack 22'' Large Bags with Reinforced Handles, 12 Oz Heavy Duty Reusable Washable Grocery Shopping Bags Plain Bags for Teacher Paint Embroidery Draw DIY Art Craft Totes

(144)
$39.99
PrimeFREE delivery Sat, Jun 14
Loading...
Purple Ladybug Decorate Your Own Water Bottle for Kids Craft Kits - DIY Unicorn Girls Gifts 8-12 Years Old, Arts and Crafts for Girls Age 8-10 - Fun Travel Activities for Kids

Purple Ladybug Decorate Your Own Water Bottle for Kids Craft Kits - DIY Unicorn Girls Gifts 8-12 Years Old, Arts and Crafts for Girls Age 8-10 - Fun Travel Activities for Kids

(31,188)
$15.99
FREE delivery Sat, Jun 14 on your first order
50+ bought in past month
Loading...
Sunrad Foil Art Kit for Kids Unicorns & Princesses Arts and Crafts, No Mess Art for Kids, Fun Craft Kits & Supplies, DIY Creative Activities, Travel Toys Gifts for Girls & Boys Ages 4 5 6 7 8 9+

Sunrad Foil Art Kit for Kids Unicorns & Princesses Arts and Crafts, No Mess Art for Kids, Fun Craft Kits & Supplies, DIY Creative Activities, Travel Toys Gifts for Girls & Boys Ages 4 5 6 7 8 9+

(162)
$23.99$19.72
FREE delivery Sat, Jun 14 on your first order
100+ bought in past month
Loading...
Generic Collapsible Washing up Bowl Folding Dish Basin Bucket Portable Dish Pan Foldable Wash Basin for Camping Beach RV Backpacking, Green 38x23.5x11.5cm

Generic Collapsible Washing up Bowl Folding Dish Basin Bucket Portable Dish Pan Foldable Wash Basin for Camping Beach RV Backpacking, Green 38x23.5x11.5cm

(0)
$12.19
FREE delivery Aug 18 - 28