import type { FormEvent } from 'react';
import { useState, useEffect } from 'react';
import { toast } from 'sonner';
import { ChevronDown } from 'lucide-react';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Button } from '@/components/ui/button';
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '@/components/ui/collapsible';
import { useClient } from 'hooks/useClient';
type GoogleOAuthSettings = {
clientId: string;
clientSecret: string;
};
const SCOPES = [
{ scope: 'gmail.readonly', description: 'Read emails' },
{ scope: 'calendar.readonly', description: 'Read calendar events' },
];
const SetupGuide = ({ redirectUri }: { redirectUri: string }) => {
const [open, setOpen] = useState(false);
return (
Go to the{' '}
New Project
{' '}
page. Give it a name (e.g. "Officer") and click Create.
Go to{' '}
API Library
. Search for and enable each of these:
Click each one, then click Enable.
Go to{' '}
OAuth Branding
.
Go to{' '}
OAuth Audience
.
In the left sidebar, click{' '}
Data Access
, then click Add or remove scopes. Search for and add:
Click Update, then Save.
Note:
In the left sidebar, click{' '}
Clients
, then click Create OAuth client.
A dialog will show your Client ID and Client Secret. Copy both and paste
them into the fields below.
{SCOPES.map((s) => (
{s.scope} —{' '}
{s.description}
calendar.readonly{' '}
is classified as sensitive and{' '}
gmail.readonly as{' '}
restricted by Google. This is fine for Internal apps (Google Workspace) and External apps
in testing mode. Publishing to production with restricted scopes requires Google verification.
{redirectUri}