mirror of
https://github.com/sigma67/ytmusicapi.git
synced 2026-04-25 07:16:00 +03:00
[GH-ISSUE #378] setup oauth with function #297
Labels
No labels
a/b
bug
documentation
enhancement
good first issue
help wanted
invalid
pull-request
question
wontfix
yt-error
yt-update
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ytmusicapi#297
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @MisileLab on GitHub (Apr 14, 2023).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/378
Is your feature request related to a problem? Please describe.
I want to setup oauth with function, but I can't it because setup_oauth function uses terminal.
Describe the solution you'd like
make a oauth function
Describe alternatives you've considered
Additional context
@sigma67 commented on GitHub (Apr 14, 2023):
How would that work? Someone still needs to access the site, log in and confirm the authorization. It's not possible to do this in a fully automated fashion without user interaction, unless you use the
browserauth.@sigma67 commented on GitHub (Apr 14, 2023):
I suppose it would be possible to move the input statement out of
get_code, that would allow people to code their own oauth flows in say, Desktop apps.You could then do:
Is that what you intended?
@MisileLab commented on GitHub (Apr 15, 2023):
Yes, thank you
@apastel commented on GitHub (Feb 11, 2024):
For anyone reading, in the latest version of ytmusicapi (1.5.2 as of today), it would use the
OAuthCredentialsclass and thetoken_from_code()function.However even though
token_from_codeis documented to return aRefreshableTokenDict, the token it's returning is missing theexpires_atproperty, which makes it invalid and results in a 401 Unauthorized when trying to use it. It hasexpires_inandaccess_tokenbut noexpires_at. I'm trying to figure out how to make it a proper refresh token -- wondering if I'm missing something.@sigma67 commented on GitHub (Feb 12, 2024):
@apastel what you want is a
RefreshingToken:github.com/sigma67/ytmusicapi@98e0bc749c/ytmusicapi/auth/oauth/token.py (L129-L131)Feel free to suggest/submit non-breaking usability changes or documentation if you find time :)
@apastel commented on GitHub (Feb 12, 2024):
@sigma67 Thanks, I figured it had something to do with that but wasn't sure.
My updated code looks like this and is working: