Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oauth2.0 approval_prompt = force #5

Closed
vtsao opened this issue Dec 20, 2013 · 5 comments
Closed

Oauth2.0 approval_prompt = force #5

vtsao opened this issue Dec 20, 2013 · 5 comments
Assignees
Labels

Comments

@vtsao
Copy link
Contributor

vtsao commented Dec 20, 2013

Hello All,

I am not seeing approval_prompt option under Oauth2.0 authentication which can enable user to approve appllication request every time he logged in with google account.

For more info please see this forum question:
https://groups.google.com/forum/#!searchin/adwords-api/oauth2.0/adwords-api/GTClxukrLCE/GdO1bRsGkWkJ

No option for this under PHP Client library v201306.

Thanks,
Chirag
Jul 17, 2013 Delete comment #1 chirag.ebrandz
Hi,

Any update?
Jul 22, 2013 Delete comment Project Member #2 api.pmatthews
Hi Chirag,

Thank you for your feature request. For the a quick workaround, I suggest you edit your copy of the OAuth2Handler.php to add the following:

Edit the GetAuthorizationUrl.php function to update the $params array as follows:

$params = array_merge($params, array(
    'response_type' => 'code',
    'client_id' => $credentials['client_id'],
    'redirect_uri' => $redirectUri,
    'scope' => $this->scope,
    'access_type' => $offline ? 'offline' : 'online',
    'approval_prompt' => 'force',
));

File path:
/src/Google/Api/Ads/Common/OAuth2Handler.php

See the link below for the current version:

https://code.google.com/p/google-api-adwords-php/source/browse/src/Google/Api/Ads/Common/Util/OAuth2Handler.php#59

Regards,

Yes, I dont wants to disturb API. So i have done this when getting to authorization Url by adding extra param.

    $offline = TRUE;
$extra_para = array('approval_prompt' => 'force');
$OAuth2Handler = $user->GetOAuth2Handler();
$authorizationUrl = $OAuth2Handler->GetAuthorizationUrl($user->GetOAuth2Info(), $redirectUri, $offline, $extra_para);

I have one more Question under enhancement.
I am not getting any user information by calling Oauth 2.0. For e.g. user email.
For this i need to add any other scope. So how i can add other scopes?

Thanks,
Chirag
Sep 26, 2013 Delete comment Project Member #5 api.pmatthews
We're looking into adding a config parameter for the approval_promt setting.

Can you explain what service you're calling that is not returning a user email?

Regards,

I'm trying to calling CustomerService.
CustomerService that will give me idea about customer who tryed to get data using API.
This will help a lot when user is using MCC account for authentication, and adwords account has no CompanyName / Name info.
Oct 4, 2013 Delete comment #7 chirag.ereportz
Also, I requested you to Add all beta feature to be available for all developer.

@saturnism
Copy link
Contributor

while you can't set it in the array, you can still append it to the URL if you need to.

@chiragvels
Copy link

Hello,

'approval_prompt' => 'force' is not working as expected.
If I pass the 'approval_prompt' => 'force', it is still not asking user to authorize app forcefully If I already had login with already authorized adwords account.

Also It is not returning refresh_token with $user->GetOAuth2Info() under below code.

$OAuth2Handler = $user->GetOAuth2Handler();
$user->SetOAuth2Info($OAuth2Handler->GetAccessToken($user->GetOAuth2Info(),
$code, $redirectUri));
$user->GetOAuth2Info();

Thanks,

@vtsao vtsao self-assigned this Oct 18, 2016
@vtsao
Copy link
Contributor Author

vtsao commented Oct 20, 2016

Hi @chiragvels approval_prompt isn't supported by this library (but the beta version of this library should support it as it uses the Google Auth library). As @saturnism mentioned, you might have to add it to the URL yourself. You can find our OAuth2 documentation here:
https://developers.google.com/identity/protocols/OAuth2

Thanks,
Vincent

@chiragvels
Copy link

Hello @vtsao ,

I am passing parameters properly.
It seems to be issue with new version of library 13.1.0 and I was not facing any issue with lib version 10.0.0.
I was using approval_prompt = force since 2011, and not changed any core files for login.

However I found this issue that approval_prompt=force is replaced with prompt = consent, and that was solved this problem.

I have also conversation going on at forum, I think you can clear idea of my problem from this thread.

https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/adwords-api/iSY2uUBx5JQ/jkxpDaEUAwAJ

Thanks,

@vtsao
Copy link
Contributor Author

vtsao commented Oct 20, 2016

However I found this issue that approval_prompt=force is replaced with prompt = consent, and that was solved this problem.

mmm okay, then I guess our OAuth2 params have changed. Either way it's not specific to this library, but thanks for pointing it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants