Initiate OAuth flow to connect a service to Gmail
admin permission can connect services to Gmail.
/api/services/[id]/connect/api/services/oauth/callbackhttps://www.googleapis.com/auth/gmail.readonly - Read emailshttps://www.googleapis.com/auth/gmail.send - Send emailsclient_id - Your Google OAuth client IDredirect_uri - Your callback URLresponse_type - Always codeaccess_type - Always offline (to obtain refresh token)prompt - Always consent (to ensure refresh token is granted)scope - Gmail read and send permissionsstate - Encrypted state containing service IDgmail_oauth_state is set containing:
httpOnly: truesameSite: laxsecure: true (on HTTPS)maxAge: 600 (10 minutes)path: /requireAdminSession()GOOGLE_CLIENT_ID from environmentrefreshToken field is populated in the database. This enables: