Warm tip: This article is reproduced from serverfault.com, please click

3rd party cookies & Google OAUTH

发布于 2020-06-23 14:13:14

I started working on server side for my current porject and one of the biggest issues that i facing is with Google O-Auth. Since i am not experienced with the server i decided to use firebase throughout my project.

3rd party cookies are need to be enabled for Google OAuth. I am trying to find my way around it(means: even if the 3rd party cookies are disabled a user can login through google).

First Qestion: Is it even possible?.. i guess it is because i have tried few popular websites like bitbukcet where even if you switch off 3rd party cookies, the O auth works perfectly.

If yes then Second Question: How do i implement it? i was reading some Google Developer docs and found this "another workaround is to implement server-side OAuth 2.0 flows". I really do not understand this.

What i have tried: I have tried two things, first the typical and easier way of going with firebase auth and google login with popup. Second, Login through GAPI AUTH.

I am looking forward to any answer.

Questioner
Naveen Sharma
Viewed
0
Abhas Sinha 2020-12-01 09:04:03

You can look at this link for an overview on how to implement server side based Oauth2 flow for Google. Please ignore the bits which are youtube specific but the instructions should apply to any google auth flow. Basically you do not need to include any client side JS files on your webpage etc since they don't work with 3p cookies blocked. The server side flow is free from that restriction.

Edit: Adding a more general link for server side Oauth2 flow