[PR #206] [CLOSED] feat: add google as auth provider #791

Closed
opened 2026-02-26 18:48:56 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/documenso/documenso/pull/206
Author: @doug-andrade
Created: 6/12/2023
Status: Closed

Base: feat/refreshHead: refresh/google-provider


📝 Commits (4)

  • 39e3ca9 feat: adding google provider
  • 8ec53a8 fix: changing references to id and email to reflect schema changes
  • 877b7f6 resolving build errors from unused imports
  • 40ee968 add Avatar Image to header

📊 Changes

20 files changed (+166 additions, -33 deletions)

View changed files

📝 .env.example (+4 -0)
📝 apps/marketing/process-env.d.ts (+3 -0)
apps/web/next-auth.d.ts (+17 -0)
📝 apps/web/process-env.d.ts (+3 -0)
📝 apps/web/src/app/(dashboard)/documents/page.tsx (+1 -1)
📝 apps/web/src/app/(dashboard)/layout.tsx (+1 -4)
📝 apps/web/src/components/(dashboard)/layout/profile-dropdown.tsx (+2 -1)
📝 apps/web/src/components/forms/profile.tsx (+1 -1)
📝 apps/web/src/components/forms/signin.tsx (+2 -2)
📝 apps/web/src/pages/api/document/create.ts (+0 -1)
📝 apps/web/src/pages/api/stripe/webhook/index.ts (+2 -2)
📝 packages/lib/next-auth/auth-options.ts (+42 -8)
📝 packages/lib/server-only/document/find-documents.ts (+1 -1)
📝 packages/lib/server-only/document/get-document-by-id.ts (+1 -1)
📝 packages/lib/server-only/document/get-stats.ts (+1 -1)
📝 packages/lib/server-only/user/update-password.ts (+1 -1)
📝 packages/lib/server-only/user/update-profile.ts (+1 -1)
packages/prisma/migrations/20230612025301_google_provider/migration.sql (+63 -0)
📝 packages/prisma/schema.prisma (+17 -7)
📝 turbo.json (+3 -1)

📄 Description

Added Google as a provider in Next Auth.

Please Note:

  • Prisma Schema was changed
  • Mainly the User.id is now a cuid()
  • References to User.id as a number or int have been changed to string.
  • In some places I has to assert User.email!, I am not sure why but NextAuth's example for the Prisma Adapter allows the email to be nullable: email String? @unique Prisma Adapter Reference
  • You need to create credentials in the Google Cloud Console.

Configuration Google Provider Reference

Create Credentials - https://console.developers.google.com/apis/credentials

The "Authorized redirect URIs" used when creating the credentials must include your full domain and end in the callback path.

Examples:
For production: https://{YOUR_DOMAIN}/api/auth/callback/google
For development: http://localhost:3000/api/auth/callback/google

Video:
https://www.loom.com/share/2ff960207bbd442e881cbee5ae6366a0

Build Result:

web % npm run build

> @documenso/web@0.1.0 build
> next build

...
...
...

Route (app)                                Size     First Load JS
┌ ○ /                                      135 B          77.6 kB
├ λ /dashboard                             0 B                0 B
├ λ /documents                             0 B                0 B
├ λ /documents/[id]                        0 B                0 B
├ λ /settings                              0 B                0 B
├ λ /settings/billing                      0 B                0 B
├ λ /settings/password                     0 B                0 B
├ λ /settings/profile                      0 B                0 B
├ ○ /signin                                0 B                0 B
└ ○ /signup                                0 B                0 B
+ First Load JS shared by all              77.5 kB
  ├ chunks/7fd0f9f1-3fb3dc3e14815666.js    50.5 kB
  ├ chunks/9-cf592fc7a319a8e7.js           24.4 kB
  ├ chunks/main-app-9a6c377ca6c4fdfa.js    211 B
  └ chunks/webpack-51fa59e154539451.js     2.33 kB

Route (pages)                              Size     First Load JS
┌ ○ /404                                   178 B          86.7 kB
├ λ /api/auth/[...nextauth]                0 B            86.5 kB
├ λ /api/claim-plan                        0 B            86.5 kB
├ λ /api/document/create                   0 B            86.5 kB
├ λ /api/stripe/webhook                    0 B            86.5 kB
└ λ /api/trpc/[trpc]                       0 B            86.5 kB
+ First Load JS shared by all              86.5 kB
  ├ chunks/main-c32231f5001c0b96.js        84 kB
  ├ chunks/pages/_app-415a5670032b79f5.js  190 B
  └ chunks/webpack-51fa59e154539451.js     2.33 kB

ƒ Middleware                               22.9 kB

λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)(Static)  automatically rendered as static HTML (uses no initial props)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/documenso/documenso/pull/206 **Author:** [@doug-andrade](https://github.com/doug-andrade) **Created:** 6/12/2023 **Status:** ❌ Closed **Base:** `feat/refresh` ← **Head:** `refresh/google-provider` --- ### 📝 Commits (4) - [`39e3ca9`](https://github.com/documenso/documenso/commit/39e3ca9f945359869515bd7d450939943e40df65) feat: adding google provider - [`8ec53a8`](https://github.com/documenso/documenso/commit/8ec53a8f3df34e20a4ae18116b095e121a9fd4ab) fix: changing references to id and email to reflect schema changes - [`877b7f6`](https://github.com/documenso/documenso/commit/877b7f6c018b6aa8d349306d75fd314ba1d4406c) resolving build errors from unused imports - [`40ee968`](https://github.com/documenso/documenso/commit/40ee9684353afdab6acdc76d8d9ec648f151a854) add Avatar Image to header ### 📊 Changes **20 files changed** (+166 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+4 -0) 📝 `apps/marketing/process-env.d.ts` (+3 -0) ➕ `apps/web/next-auth.d.ts` (+17 -0) 📝 `apps/web/process-env.d.ts` (+3 -0) 📝 `apps/web/src/app/(dashboard)/documents/page.tsx` (+1 -1) 📝 `apps/web/src/app/(dashboard)/layout.tsx` (+1 -4) 📝 `apps/web/src/components/(dashboard)/layout/profile-dropdown.tsx` (+2 -1) 📝 `apps/web/src/components/forms/profile.tsx` (+1 -1) 📝 `apps/web/src/components/forms/signin.tsx` (+2 -2) 📝 `apps/web/src/pages/api/document/create.ts` (+0 -1) 📝 `apps/web/src/pages/api/stripe/webhook/index.ts` (+2 -2) 📝 `packages/lib/next-auth/auth-options.ts` (+42 -8) 📝 `packages/lib/server-only/document/find-documents.ts` (+1 -1) 📝 `packages/lib/server-only/document/get-document-by-id.ts` (+1 -1) 📝 `packages/lib/server-only/document/get-stats.ts` (+1 -1) 📝 `packages/lib/server-only/user/update-password.ts` (+1 -1) 📝 `packages/lib/server-only/user/update-profile.ts` (+1 -1) ➕ `packages/prisma/migrations/20230612025301_google_provider/migration.sql` (+63 -0) 📝 `packages/prisma/schema.prisma` (+17 -7) 📝 `turbo.json` (+3 -1) </details> ### 📄 Description Added Google as a provider in Next Auth. **Please Note:** - Prisma Schema was changed - Mainly the `User.id` is now a `cuid()` - References to `User.id` as a `number` or `int` have been changed to string. - In some places I has to assert `User.email!`, I am not sure why but NextAuth's example for the Prisma Adapter allows the email to be nullable: `email String? @unique` [Prisma Adapter Reference](https://authjs.dev/reference/adapter/prisma) - You need to create credentials in the Google Cloud Console. **Configuration** [Google Provider Reference](https://next-auth.js.org/providers/google) Create Credentials - https://console.developers.google.com/apis/credentials The "Authorized redirect URIs" used when creating the credentials must include your full domain and end in the callback path. >Examples: For production: `https://{YOUR_DOMAIN}/api/auth/callback/google` For development: `http://localhost:3000/api/auth/callback/google` **Video:** https://www.loom.com/share/2ff960207bbd442e881cbee5ae6366a0 **Build Result:** ```bash web % npm run build > @documenso/web@0.1.0 build > next build ... ... ... Route (app) Size First Load JS ┌ ○ / 135 B 77.6 kB ├ λ /dashboard 0 B 0 B ├ λ /documents 0 B 0 B ├ λ /documents/[id] 0 B 0 B ├ λ /settings 0 B 0 B ├ λ /settings/billing 0 B 0 B ├ λ /settings/password 0 B 0 B ├ λ /settings/profile 0 B 0 B ├ ○ /signin 0 B 0 B └ ○ /signup 0 B 0 B + First Load JS shared by all 77.5 kB ├ chunks/7fd0f9f1-3fb3dc3e14815666.js 50.5 kB ├ chunks/9-cf592fc7a319a8e7.js 24.4 kB ├ chunks/main-app-9a6c377ca6c4fdfa.js 211 B └ chunks/webpack-51fa59e154539451.js 2.33 kB Route (pages) Size First Load JS ┌ ○ /404 178 B 86.7 kB ├ λ /api/auth/[...nextauth] 0 B 86.5 kB ├ λ /api/claim-plan 0 B 86.5 kB ├ λ /api/document/create 0 B 86.5 kB ├ λ /api/stripe/webhook 0 B 86.5 kB └ λ /api/trpc/[trpc] 0 B 86.5 kB + First Load JS shared by all 86.5 kB ├ chunks/main-c32231f5001c0b96.js 84 kB ├ chunks/pages/_app-415a5670032b79f5.js 190 B └ chunks/webpack-51fa59e154539451.js 2.33 kB ƒ Middleware 22.9 kB λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps) ○ (Static) automatically rendered as static HTML (uses no initial props) ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 18:48:56 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#791
No description provided.