How to setup Google login with Docker and production environment?

76 views
Skip to first unread message

oon arfiandwi

unread,
May 25, 2022, 10:37:27 AM5/25/22
to NYT Library Community

Hi,
thank you for developing Library, love it!

I have successfully installed Library with Docker, 
by following the instruction on README
It includes cloning the custom directory from the example.

After successfully building the content with the development environment,
I change the NODE_ENV to production.
I have set up all the needed OAuth on Google Cloud Console,
and the Google login prompt showed up, I have login with the correct domain and it redirected as well.

The browser shows as "Not Authorized
The page you're trying to access is forbidden. Please try logging in with another account, or contact your organization's administrators for assistance."

The docker logs show:
```
info: Google API auth successfully retrieved.
info: User not authenticated
error: Serving an error page for /  
{
 message: 'Unauthorized',
 stack: 'Error: Unauthorized\n' +
   '    at /usr/src/app/server/userAuth.js:93:17\n' +
   '    at handleReturn (/usr/src/app/node_modules/express-promise-router/lib/express-promise-router.js:24:23)\n' +
   '    at /usr/src/app/node_modules/express-promise-router/lib/express-promise-router.js:64:7\n' +
   '    at Layer.handle [as handle_request] (/usr/src/app/node_modules/express/lib/router/layer.js:95:5)\n' +
   '    at trim_prefix (/usr/src/app/node_modules/express/lib/router/index.js:328:13)\n' +
   '    at /usr/src/app/node_modules/express/lib/router/index.js:286:9\n' +
   '    at Function.process_params (/usr/src/app/node_modules/express/lib/router/index.js:346:12)\n' +
   '    at next (/usr/src/app/node_modules/express/lib/router/index.js:280:10)\n' +
   '    at SessionStrategy.strategy.pass (/usr/src/app/node_modules/passport/lib/middleware/authenticate.js:343:9)\n' +
   '    at /usr/src/app/node_modules/passport/lib/strategies/session.js:69:12'
}
```
Any idea how to debug the passport with Google login?
I have tried to remove the userAuth.js from the custom example,
but the problem still persists.

thank you for your help.

-- 
sincerely,
oon arfiandwi

Andrew Fischer

unread,
May 25, 2022, 10:53:05 AM5/25/22
to NYT Library Community
Hi Oon,

Do you want to remove auth completely, or are you trying to get google login to work? If the latter, are you getting the google auth page to pop up when you visit your library URL?

-Andrew

Gent Brandon

unread,
Jul 18, 2023, 4:44:15 PM7/18/23
to NYT Library Community
Hi there,

I got the same situation as OP.

Deployed with docker, container is running, app accessible. The log shows "info: Google API auth successfully retrieved". When visiting the app URL, it redirects to the Google auth page. After logging in, we get the same error messages as mentioned by OP (in browser: "Not Authorized
The page you're trying to access is forbidden..."; in logs: "info: User not authenticated error: Serving an error page...").

Tried with a team drive as well as a folder, and different user access levels in GDrive (editor, admin).

Any suggestions what could be missing?

Thanks for any advice!
Reply all
Reply to author
Forward
0 new messages