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

Add support for refreshing access tokens #8

Open
akshgpt7 opened this issue Jun 4, 2020 · 0 comments
Open

Add support for refreshing access tokens #8

akshgpt7 opened this issue Jun 4, 2020 · 0 comments
Labels
help wanted Extra attention is needed oauth

Comments

@akshgpt7
Copy link
Owner

akshgpt7 commented Jun 4, 2020

Currently, the response_type parameter is set by default to token. This means we can't refresh the access token obtained.
To refresh access tokens, access_type=offline has to be additionally passed while making the oauth request, which does not work with response_type=token. Instead, response_type must be set to code.

It is desired that if the user enters the refresh token (if they have it), youtube-deno handles the refresh flow and generates the new access token internally.

To achieve this:

  • Remove the default value of response_type from here and let the user enter it as a required parameter.
  • Change the second argument of the YouTube class to an object type, which can take three types of values: {access_token: "some-token"}, {refresh_token: "some-token"}, or {auth_code: "some-code"}.
  • If the access_token is directly passed, store it to the this.token class variable. Else if refresh_token is passed, trigger the refresh flow and the returned access token is stored in this.token. If auth_code is passed, exchange it for access_token and store it in this.token.
@akshgpt7 akshgpt7 added help wanted Extra attention is needed oauth and removed oauth labels Jun 4, 2020
@akshgpt7 akshgpt7 pinned this issue Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed oauth
Projects
None yet
Development

No branches or pull requests

1 participant