Sveltekit Netlify Google Oauth Example screenshot

Sveltekit Netlify Google Oauth Example

Author Avatar Theme by Duffn
Updated: 9 Jun 2022
7 Stars

A long-titled repository showing how you could potentially use SvelteKit deployed to Netlify with Google OAuth for authentication.

Categories

Overview

The “sveltekit-netlify-google-oauth-example” repository demonstrates how SvelteKit can be used with Netlify and Google OAuth for authentication. It is not the only approach, but one possible way to achieve this functionality.

Features

  • Demo: The repository includes a demo of the SvelteKit application.
  • Setup: Step-by-step instructions are provided for setting up the application locally.
  • Local: Explains how to configure and run the application on a local machine.
  • OAuth 2.0 credentials: Guides users on creating OAuth 2.0 credentials for their application.
  • Netlify: Provides instructions on generating OAuth 2.0 credentials and secrets for Netlify.
  • Deployment: Describes how to deploy the application to Netlify.
  • Acknowledgements: Thanks various articles and authors for their guidance and inspiration.

Installation

To install and run the “sveltekit-netlify-google-oauth-example” theme, follow these steps:

  1. Create OAuth 2.0 credentials for your application.
  2. Add an authorized redirect URI entry for http://localhost:3000/auth/callback.
  3. Copy .env.sample to .env.
  4. Generate secrets for JWT and cookie signing.
  5. Optionally, set AUTHORIZED_DOMAIN to restrict authentication to a specific domain.
  6. Install the required dependencies.
  7. Run the application locally.

To deploy the application to Netlify:

  1. Generate new OAuth 2.0 credentials and secrets for Netlify.
  2. Add a new authorized redirect URI entry for https://my-netlify-app-name.netlify.app/auth/callback.
  3. Add these credentials and secrets as environment variables in the build deployment settings of your Netlify site.
  4. Set NODE_ENV=production and AUTH_REDIRECT=https://my-netlify-app-name.netlify.app/auth/callback.
  5. Deploy the application to Netlify.

Summary

The “sveltekit-netlify-google-oauth-example” repository provides a demonstration of using SvelteKit with Netlify and Google OAuth for authentication. It offers step-by-step instructions for local setup and deployment to Netlify. The repository also acknowledges the help received from various articles and authors.