Google apis auth is not enabled
Hi everyone, I have an issue with connecting Google calendar & mail. I've enabled the People API, Mail and Calendar APIs as well as added the URIs in the project. When checking the docker log for twenty-server-1 I see the following:
Exception Captured
{
user: { id: '5ecb56b6-dc78-4ce7-98cf-3bf43b44dc4a' },
workspace: { id: 'aa11a739-2652-4c22-91bd-97ea393cc5fb' }
}
[
AuthException [Error]: Google apis auth is not enabled
at GoogleAPIsOauthRequestCodeGuard.canActivate (/app/packages/twenty-server/dist/src/engine/core-modules/auth/guards/google-apis-oauth-request-code.guard.js:44:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async GuardsConsumer.tryActivate (/app/node_modules/@nestjs/core/guards/guards-consumer.js:16:17)
at async canActivateFn (/app/node_modules/@nestjs/core/router/router-execution-context.js:134:33)
at async /app/node_modules/@nestjs/core/router/router-execution-context.js:42:31
at async /app/node_modules/@nestjs/core/router/router-proxy.js:9:17
at async /app/node_modules/@nestjs/core/router/router-explorer.js:166:17 {
code: 'GOOGLE_API_AUTH_DISABLED'
}
]
This is my .env:
MESSAGING_PROVIDER_GMAIL_ENABLED=true
CALENDAR_PROVIDER_GOOGLE_ENABLED=true
AUTH_PASSWORD_ENABLED=false
AUTH_GOOGLE_APIS_CALLBACK_URL=http://server-ip:3002/auth/google-apis/get-access-token
AUTH_GOOGLE_ENABLED=true
AUTH_GOOGLE_CLIENT_ID=xxx-yyy.apps.googleusercontent.com
AUTH_SSO_ENABLED=true
AUTH_GOOGLE_CLIENT_SECRET=GOCSPX-xxxxx
AUTH_GOOGLE_CALLBACK_URL=http://server-ip:3002/auth/google/redirect
Any ideas? I've also tried running the cron jobs from the documentation.
13 Replies
cc @Raphaël
@thomast @Raphaël any ideas? 🙂
Hello @Andreas, I'm taking a look at your issue 🙂
This error happens only when MESSAGING_PROVIDER_GMAIL_ENABLED or CALENDAR_PROVIDER_GOOGLE_ENABLED is set to false. Did you update the
.env
both in your worker and your server?
Could you double check that you did every step in https://twenty.com/developers/section/self-hosting/setup#setup-messaging-&-calendar-sync correctly? If the error persists we can take a look at it togetherHmm, how do you mean .env in worker and server? How do I access those? 🤔 @Raphaël
can you run
docker exec <container_id> env
I remember one self hoster had the problem where he had two .env files, one for the server and one for the worker, and he set these variables only in one of these.
If you did the one click config, you should only have one
root@ubuntu-etc-server:~/projects/twenty/twenty# docker exec twenty-worker-1 env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=e868db691ee5
STORAGE_S3_NAME=
APP_SECRET=hashedpw
FRONT_BASE_URL=http://serverip:3002
REDIS_URL=redis://:hashedpw@redis:6380
ENABLE_DB_MIGRATIONS=false
PG_DATABASE_URL=postgres://twenty:twenty@db:5432/default
SERVER_URL=http://serverip:3002
STORAGE_S3_REGION=
STORAGE_TYPE=local
STORAGE_S3_ENDPOINT=
NODE_VERSION=18.17.1
YARN_VERSION=1.22.19
REACT_APP_SERVER_BASE_URL=
SENTRY_RELEASE=
HOME=/home/node
root@ubuntu-etc-server:~/projects/twenty/twenty# docker exec twenty-server-1 env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=fea9cd8c45f7
PORT=3000
STORAGE_S3_ENDPOINT=
STORAGE_S3_NAME=
SERVER_URL=http://server-ip:3002
SIGN_IN_PREFILLED=false
FRONT_BASE_URL=http://server-ip:3002
STORAGE_TYPE=local
REDIS_URL=redis://:hashedpw@redis:6380
APP_SECRET=hashedpw
ENABLE_DB_MIGRATIONS=true
STORAGE_S3_REGION=
PG_DATABASE_URL=postgres://twenty:twenty@db:5432/default
NODE_VERSION=18.17.1
YARN_VERSION=1.22.19
REACT_APP_SERVER_BASE_URL=
SENTRY_RELEASE=
HOME=/home/node
Hmm you're correct I think @Raphaël? I followed the one click guide though. What would you suggest as next step to resolve?
@charles
@Andreas In order to add an env variable to your containers, you'll need to:
- add them to your env variable in the docker-compose.yml
- (optional) docker-compose can refer to .env file so you might also want to add them to .env and refer to them from docker-compose.yml
@charles hmm ok so I simply add MESSAGING_PROVIDER_GMAIL_ENABLED=true & CALENDAR_PROVIDER_GOOGLE_ENABLED=true in the docker-compose.yml?
@Andreas yes or as suggested by @charles you can use your env variables and add to the docker-compose.yml
and update the .env with the corresponding values
Hey! Seems to have solved the problem 🙌 if I want to check the logs to see that the mail sync is working as it should, where do I find it?
You can look at them inside the
twenty-worker-1
logs 🙂