Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

login with google always asks user consent

I've got an internal web app for my company that uses a login with google authentication system. It's working well for the most part, they can authenticate with google, give consent for my app to access basic user details, and then when they are returned to my app, I can indeed get their user details.

The issue is that I thought once they give consent they wouldn't have to do it each time. Is this an incorrect assumption? As it is now, each time they click the "login with google" they must give consent rather than being redirected back to my app.

I'm using PHP (codeigniter) and a pretty good Oauth lib found on github (fork of phil sturgeon's library). Is there some param I should be passing so the user doesn't have to give consent every time, after the first time?

like image 725
Greg Avatar asked Feb 17 '13 17:02

Greg


People also ask

What is Google OAuth consent screen?

The OAuth consent screen is a prompt that tells users who's requesting access to their data and what kind of data users are allowing your app to access.

What is user consent?

User consent is a fairly straightforward concept. At its core, user consent is the permission granted by users to a website or organization to proceed with their data collection. A user's consent is primarily used for advertising and marketing purposes.

Is signing in with Google Safe?

Sign in with Google authenticates you uniquely for each service. So, even if there is a data breach on any of the sites or services you use, your personal information on all other accounts stays safe from hackers.

How do I change the Google email consent?

If you want to change the email address that is displayed to the user you have to: Add permission for the new email address to handle the project: Menu > IAM & Admin > IAM , then click on the Add button, enter the email address and select Role > Project > Owner. Accept the invitation from the new email address.


1 Answers

Google login does not require user consent every time. If you're using OAuth2 Login procedure, you should be able to login a second time w/o re-approvals: https://developers.google.com/accounts/docs/OAuth2Login

In some contexts, however, it is possible for auto-approval to become disabled, with the subsequent requirement of user consent on every login.

The first and most common case is if your application explicitly requests Google to prompt for consent everytime. Check if your authorization request (which you may have copied from an example or sample code) includes 'prompt=consent' or the older, non-standard form 'approval_prompt=force'. Removing these parameters (if present), will likely cause auto-approval to start working.

Another situation is if your redirect URL is based on 'localhost' or some other URL that does not belong to the global DNS namespace. In this case, for security reasons, Google sets a cookie on the user's computer, in the accounts.google.com domain, to signal that the user authorized _this_device_ to login to 'foo' on localhost (or local domain); Google will only auto-approve w/o consent a 2nd request if it finds the cookie. The reason is that the meaning of 'localhost' (or local domain, or other URL not built on global DNS namespace) is device-dependent, and allowing the authorization to apply across devices could introduce security risks. So if your company has configured browsers to clear all cookies on exit, and you use a non-absolute URL, you could see your users having to consent everytime. The solution is either to host your endpoint on an Internet-valid hostname (the host doesn't need to be accessible from outside the Intranet, just the hostname needs to be globally valid), or you need to exempt accounts.google.com from the cookie clearing policy.

like image 67
breno Avatar answered Oct 26 '22 04:10

breno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!