A long-titled repository showing how you could potentially use SvelteKit deployed to Netlify with Google OAuth for authentication.
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:
- Create OAuth 2.0 credentials for your application.
- Add an authorized redirect URI entry for http://localhost:3000/auth/callback.
- Copy
.env.sample to .env. - Generate secrets for JWT and cookie signing.
- Optionally, set
AUTHORIZED_DOMAIN to restrict authentication to a specific domain. - Install the required dependencies.
- Run the application locally.
To deploy the application to Netlify:
- Generate new OAuth 2.0 credentials and secrets for Netlify.
- Add a new authorized redirect URI entry for https://my-netlify-app-name.netlify.app/auth/callback.
- Add these credentials and secrets as environment variables in the build deployment settings of your Netlify site.
- Set
NODE_ENV=production and AUTH_REDIRECT=https://my-netlify-app-name.netlify.app/auth/callback. - 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.