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

Allow not auto-opening browser for oauth workflow #307

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Latent-Logic
Copy link
Contributor

I have multiple browser profiles and would like to manually choose which profile to open the oauth workflow in, but the auto-open browser library doesn't provide that granular level of control. Because of that I'd like to have the option to simply print the url to open to the log and then I can manually open that url in the browser tab of my choice.

Copy link
Contributor

@Braastos Braastos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had the same issue, but noticed one problem with your code.

twitchAPI/oauth.py Outdated Show resolved Hide resolved
while self._user_token is None:
await asyncio.sleep(0.01)
else:
self.logger.info(f"To authenticate open: {self._build_auth_url()}")
Copy link
Contributor

@Braastos Braastos May 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if logging the url is needed, because you can retrieve the url with return_auth_url() method from your own code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the reason why I want to log the url here is that the .authenticate( call is blocking as it is opening a listener for the response from twitch. You are right that the calling code could run .return_auth_url( before calling authenticate to present the url to the user, but I think it is helpful to not require the calling code to know it needs to do so, and logging the data info will usually be visible if the user if running via the CLI.

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

Successfully merging this pull request may close these issues.

2 participants