Backend /

Configure OAuth Login: Google and GitHub

OAuth lets visitors sign in to your Creght site with an existing Google or GitHub account. These users belong to your project Auth system, not to the Creght editor team, so you can use them for member centers, private pages, bookings, downloads, and customer portals.

This guide explains the setup path: create an OAuth app in Google or GitHub, copy the Client ID, Client Secret, and callback URL into Creght, then ask AI to add the login UI.

Before You Start

  • Use the HTTPS domain that visitors are currently using. This can be a preview domain or your production custom domain.
  • Open Backend / Auth / OAuth Providers in the Creght editor.
  • Have access to Google Cloud Console or GitHub Developer Settings.

Find the Creght Callback URL

The Creght OAuth callback URL is simply your current site URL + /auth/oauth/callback/{provider}.

https://your-domain.com/auth/oauth/callback/google
https://your-domain.com/auth/oauth/callback/github

Make sure the domain is the one your visitors are actually using. If you are using https://www.example.com, do not enter a preview domain. If you are testing on a preview domain, use that preview domain.

Important: If you change the site domain later, you must update the OAuth callback URL in Google, GitHub, or any other provider console to the new active domain. Otherwise OAuth login will fail because the callback URL no longer matches.

Google Login

  1. Create or select a Google Cloud project.
  2. Configure the OAuth consent screen.
  3. Create an OAuth client with application type Web application.
  4. Add your site origin, for example https://your-domain.com.
  5. Add https://your-domain.com/auth/oauth/callback/google as an authorized redirect URI.
  6. Copy the Client ID and Client Secret.
Creght fieldValue
Provider Keygoogle
Display NameGoogle
Redirect URLhttps://your-domain.com/auth/oauth/callback/google
Scopesopenid,profile,email
Issuerhttps://accounts.google.com
Authorization URLhttps://accounts.google.com/o/oauth2/v2/auth
Token URLhttps://oauth2.googleapis.com/token
UserInfo URLhttps://openidconnect.googleapis.com/v1/userinfo

GitHub Login

  1. Open GitHub Settings / Developer settings / OAuth Apps.
  2. Create a new OAuth App.
  3. Set Homepage URL to your current site domain.
  4. Set Authorization callback URL to https://your-domain.com/auth/oauth/callback/github.
  5. Copy the Client ID and generate a Client Secret.
Creght fieldValue
Provider Keygithub
Display NameGitHub
Redirect URLhttps://your-domain.com/auth/oauth/callback/github
Scopesread:user,user:email
Issuerhttps://github.com
Authorization URLhttps://github.com/login/oauth/authorize
Token URLhttps://github.com/login/oauth/access_token
UserInfo URLhttps://api.github.com/user

Ask AI to Add Login UI

Add a login page with Google and GitHub login buttons.

Add a member center. Visitors who are not signed in should see all enabled OAuth providers. Signed-in users should see their avatar, name, email, and logout button.

Test and Troubleshoot

  • Test on the same domain used in the OAuth callback URL.
  • If you see redirect_uri_mismatch, compare the callback URL character by character.
  • If the site domain changes, update the callback URL in Google/GitHub and in the Creght provider settings.
  • If GitHub needs preview and production domains, create separate OAuth Apps or update the OAuth App for the active domain.
  • If Google only works for test accounts, check the consent screen publishing status and test users.

Security Notes

  • Never paste Client Secrets into page code or public content.
  • Use HTTPS for OAuth callbacks.
  • Keep scopes minimal.
  • Rotate exposed secrets immediately.

References

Render diagnostics