The auto-approval flow for response_type=code is not supported just
yet, but it is coming soon.
Refresh tokens do not expire, you can store them and bypass the login
process if you want. They will stop working only if the end user
explicitly revokes them.
Marius
Hi Marius,thanks for your answer!I'm doing some tests just to understand better the process:- I'm logged in with user "A" ( es: in gmail ).- I go to my site and i follow all the steps: add consent to my site for youtube api, get the "code", request "access_token" and "refresh token".- I subscribe user "A" to my youtube channel with this API "https://gdata.youtube.com/feeds/api/users/default/subscriptions". With "default" i asking to subscribe the current logged in user.- I save the "refresh_token" for further useAll works well!Subsequently:- I perform a login with a different user... "B"- I use the "refresh_token" ( the one from user "A" ) and i use it to get a new "access_token"- Then i try to subscribe user "B" to my YT channel. I expect something like "access denied".. instead i receive "Subscription already exists." message. So the "default" user is not "B" but "A"!Here my questions:1) Is correct to say that a "refresh_token" is 1 to 1 with a single user and all operations with the API refers to the user associated to it? This token can change only if the user remove the consense.
2) An user that visit my site can be a returning user that already has given me the consense to perform actions on his youtube profile. I want to let him to perform actions ( es add comment to a video ) without prompt another time "give me your consense". Actually, i'm storing the "refresh_token" in a session, but this "save me" only during the current navigation. If he close the browser at the next visit is newer for me! I can store the "refresh_token" to a database, but associated to which key? i need a user id! Is it possibile to do that or i'm using OAuth in a wrong way?Actually, if i don't have a "refresh_token" in session ( obviously first i check the "access_token" ) , i force user to do all the steps, but i can't bypass the consense, almost since Decembre with the new feature active ( approval_prompt=auto ).
3) Another strange behaviour is that if i'm not logged in with a google account, but i try to use a previously stored "refresh_token" for subscribe me to YT Channel i can do it! So for Google is not important if an user is currently logged in... but if i have a valid "refresh_token" :-O . I know that this is very usefull in a batch process, but is also very dangerous from user point of view. For example i can subscribe him to other channels also not related to my site, or add spam comments to video... ecc... What do you think about this?
ThanksDavide
On Dec 1, 1:47 pm, Marius Scurtescu <mscurte...@google.com> wrote:
> Hi,
>
> What you can do now is to add the approval_prompt=auto parameter and that
> will give you the behavior that will be on after December 7th.
>
> Let me know if that worked for you.
>
> Thanks,
> Marius
>
> On Tue, Nov 29, 2011 at 12:20 PM, Nischal Shetty
> <nischalshett...@gmail.com>wrote:
>
>
>
>
>
>
>
> > Yes, that is how it should be.
>
> > On 30 November 2011 01:38, Dusan Vrban <dusan.vr...@gmail.com> wrote:
>
> >> Just want to be sure... I have a test app here<http://plus.delo.je.kainoto.domovanje.com>
> >> .
>
> >> Everything fine, but indeed - whatever I did, user has to authorize the
> >> app each time.
>
> >> What you are saying is that from December 7th, these reauthorizations are
> >> history? If app is authorized, I can "refresh" user's data silently in the
> >> server (though I don't see the point to hold that data in my database).
>
> >> Basically, all I want is just to *get rid of login button (via small
> >> iframe on the page)* if I'm logged in to Google. If the user allowed my
> >> app, this iframe should just say "Hi Dusan" - after December 7th?
>
> > --
> > -Nischal
> > twitter: NischalShetty <http://twitter.com/nischalshetty>
> > facebook: Nischal <http://facebook.com/nischal>
>
> > <http://www.justunfollow.com> <http://www.grabinbox.com>
I'm getting the same problem. As of today, I'm not seeing the authorization page but instead getting redirected with an authorization code that I'm unable to exchange for a access token???
It seems to work ok if I set the approval_prompt to 'force' but if it's 'auto' or not set at all then I get a longer auth code that errors when exchanging for the access token.