Closed ssiva89 closed 1 week ago
Can you confirm whether the PUBLIC_URL
env is set? It is required for oauth to work, see https://github.com/directus/directus/issues/19331#issuecomment-1663796537
@ComfortablyCoding , yes. tried as below,
PUBLIC_URL: "http://localhost:8055"
@ComfortablyCoding , yes. tried as below,
PUBLIC_URL: "http://localhost:8055"
Can you confirm the instance was restarted after the env variable was added? If so is their any additional configuration on googles side that was added but not outlined in the docs? I cannot reproduce this issue with the provided information, once the PUBLIC_URL
variable is added it works as expected
@ComfortablyCoding it worked now. thanks but end with this one.
2024-11-12 01:12:34 directus-1 | [19:42:34] GET /auth/login/google?redirect=http%3A%2F%2Flocalhost%3A8055%2Fadmin%2Flogin%3Fcontinue%3D 302 7ms 2024-11-12 01:12:54 directus-1 | [19:42:54.561] WARN: Invalid foreign key. 2024-11-12 01:12:54 directus-1 | err: { 2024-11-12 01:12:54 directus-1 | "type": "", 2024-11-12 01:12:54 directus-1 | "message": "Invalid foreign key.", 2024-11-12 01:12:54 directus-1 | "stack": 2024-11-12 01:12:54 directus-1 | DirectusError: Invalid foreign key. 2024-11-12 01:12:54 directus-1 | at extractError (file:///directus/node_modules/.pnpm/@directus+api@file+api_@types+node@22.7.5_@unhead+vue@1.11.7_vue@3.5.11_typescript@5.6.3___en_duledcsxwterzqzubwdazkocs4/node_modules/@directus/api/dist/database/errors/dialects/sqlite.js:25:16) 2024-11-12 01:12:54 directus-1 | at translateDatabaseError (file:///directus/node_modules/.pnpm/@directus+api@file+api_@types+node@22.7.5_@unhead+vue@1.11.7_vue@3.5.11_typescript@5.6.3___en_duledcsxwterzqzubwdazkocs4/node_modules/@directus/api/dist/database/errors/translate.js:29:28) 2024-11-12 01:12:54 directus-1 | at file:///directus/node_modules/.pnpm/@directus+api@file+api_@types+node@22.7.5_@unhead+vue@1.11.7_vue@3.5.11_typescript@5.6.3___en_duledcsxwterzqzubwdazkocs4/node_modules/@directus/api/dist/services/items.js:175:39 2024-11-12 01:12:54 directus-1 | "name": "DirectusError", 2024-11-12 01:12:54 directus-1 | "extensions": { 2024-11-12 01:12:54 directus-1 | "collection": null, 2024-11-12 01:12:54 directus-1 | "field": null 2024-11-12 01:12:54 directus-1 | }, 2024-11-12 01:12:54 directus-1 | "code": "INVALID_FOREIGN_KEY", 2024-11-12 01:12:54 directus-1 | "status": 400 2024-11-12 01:12:54 directus-1 | } 2024-11-12 01:12:54 directus-1 | [19:42:54] GET /auth/login/google/callback?state=6OEd7KrPteTMUmA&code=4%2F0AeanS0YznpWP49HqYe513FKaC8-vZ37h1SNKD2Dw0d3rMn9Qok1e9eL0A&scope=email+profile+openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&authuser=0&prompt=consent 302 1.8s 2024-11-12 01:12:54 directus-1 | [19:42:54] GET /admin/login?reason=INVALID_FOREIGN_KEY 304 1ms
any idea?
Glad that worked. In terms of the new error I believe it is due to AUTH_GOOGLE_DEFAULT_ROLE_ID
being incorrect/invalid. This variable expects a valid role UUID.
As the original reported issue has been resolved I will go ahead and close this issue.
Describe the Bug
configured environment variable for google oauth integration with directus 11.1.2. i'm getting this below response when i try to login using google.
Environment variables configured:
To Reproduce
install docker create docker compose file with necessary environment variable (as mentioned above) Configuring Google OAuth for Directus (steps mentioned here : https://docs.directus.io/self-hosted/sso.html)
start the container Hit "localhost:8055" click on the "login with google"
Directus Version
v11.1.2
Hosting Strategy
Self-Hosted (Docker Image)
Database
No response