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

Should account model share refresh token with content owners association? #387

Open
pavelbonda opened this issue May 26, 2020 · 1 comment

Comments

@pavelbonda
Copy link

pavelbonda commented May 26, 2020

Hi everyone! I'm really like this gem, and appreciate how many things it does under the hood. And I have an idea for improvement.

Lets say I'm working with multiple content owners under one account, I'm getting content owner models following way:

account = Yt::Account.new(refresh_token: 'some_refresh_token')
content_owner = account.content_owners.first

When I use #refresh_token on content_owner it returns refresh token from associated Authentication model which is "inherited" from account:

content_owner.refresh_token
=> "some_refresh_token"

However instance variable @refresh_token which is used for refreshing access token does not "inherited" from account:

content_owner.instance_variable_get(:@refresh_token)
=> nil

So, when access token is expired:

content_owner.claims.first
# does not obtain new access token
# raises Yt::Errors::MissingAuth 
@pavelbonda pavelbonda changed the title Should content owners association "inherit" refresh token from account? Should account model share refresh token with content owners association May 26, 2020
@pavelbonda pavelbonda changed the title Should account model share refresh token with content owners association Should account model share refresh token with content owners association? May 26, 2020
@dgb
Copy link
Contributor

dgb commented Jun 6, 2020

Thanks for bringing this up. That seems like a pretty normal use case. IMO we should support this.

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

No branches or pull requests

2 participants