python-youtube icon indicating copy to clipboard operation
python-youtube copied to clipboard

How to use the returned refresh token next time authentcate?

Open ArnabChatterjee20k opened this issue 2 years ago • 5 comments

I am generating refresh_token but no method or attribute is present in Api class to use it to authenticate next time using the refresh_token. How to use refresh_token for authentication?

ArnabChatterjee20k avatar Mar 10 '23 01:03 ArnabChatterjee20k

If you have refresh_token, you can use method refresh_access_token to get new access token.

MerleLiuKun avatar Mar 10 '23 02:03 MerleLiuKun

But how to use it to authenticate. Means in Api class we can provide only access_token attribute no attribute for providing the refresh_token

ArnabChatterjee20k avatar Mar 10 '23 02:03 ArnabChatterjee20k

I don't know your mean?

The refresh_token is to exchange the access token, If your current access token has invalid.

You can use the refresh_token to get new access token. Then you can use the new access token to get data

MerleLiuKun avatar Mar 10 '23 03:03 MerleLiuKun

The confusing point is that when I call refresh_access_token() it only returns with new access_token without new refresh_token, but I guess it's because we can keep reusing the old refresh_token received from he initial token generation repeatedly

maxoja avatar Sep 25 '23 22:09 maxoja

Yes, You are right, The refresh_token can be alaways use before it been invalid.

MerleLiuKun avatar Sep 26 '23 02:09 MerleLiuKun