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

WebAPI V2 #29

Merged
merged 60 commits into from Oct 10, 2020
Merged

WebAPI V2 #29

merged 60 commits into from Oct 10, 2020

Conversation

hunterjm
Copy link
Contributor

@hunterjm hunterjm commented Oct 1, 2020

This is a working draft for a major version increment based off of #17, except it adds true OAuth2 support instead of web scraping for authentication.

To test, register a new application in Azure AD and add http://localhost:8080/auth/callback as a redirect URL. Then generate a client secret. Set CLIENT_ID and CLIENT_SECRET env vars and run xbox-authenticate.

To do:

  • ms_cv integration (maybe optional kwarg no_cll_vec: bool for Session.request
  • Add RequestSigner / SignedSession
  • Implement Store endpoint
  • Fix message endpoint
  • Test all the endpoints for validity (automate too)
  • Argument parser for xbox-authenticate script
  • Fix xbox-searchlive
  • Add Smartglass endpoint (xccs)
  • Tests for authentication
  • Edit README and docs to reflect new API and OAuth setup
  • Bump to 2.0.0
  • Pin other OpenXbox libs to 1.x

@hunterjm
Copy link
Contributor Author

hunterjm commented Oct 1, 2020

To keep it simple, I removed support for saving tokens to file for now. I will add that back in later.

@hunterjm
Copy link
Contributor Author

hunterjm commented Oct 1, 2020

Cherry picked @tuxuser work on vcrpy conversion and will start converting tests.

Copy link
Member

@tuxuser tuxuser left a comment

Choose a reason for hiding this comment

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

See requested changes. Most changes are needed for a greater flexibility.

xbox/webapi/authentication/manager.py Outdated Show resolved Hide resolved
xbox/webapi/authentication/manager.py Outdated Show resolved Hide resolved
xbox/webapi/authentication/manager.py Outdated Show resolved Hide resolved
xbox/webapi/authentication/manager.py Outdated Show resolved Hide resolved
xbox/webapi/authentication/manager.py Outdated Show resolved Hide resolved
xbox/webapi/authentication/manager.py Outdated Show resolved Hide resolved
xbox/webapi/authentication/manager.py Outdated Show resolved Hide resolved
xbox/webapi/authentication/manager.py Outdated Show resolved Hide resolved
xbox/webapi/authentication/manager.py Outdated Show resolved Hide resolved

CLIENT_ID = os.environ["CLIENT_ID"]
Copy link
Member

Choose a reason for hiding this comment

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

I agree, passing it via environment variables is what you usually do in production software when it comes to passing such configuration parameters.
Does it work the same in windows tho?

Like: CLIENT_ID="123" CLIENT_SECRET="321" xbox-authenticate ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can't do all-in-one in Windows, but can use setx CLIENT_ID "12368654" and it will be available in subsequent command prompts. Of course there is also a GUI way of doing it.

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer reintroducing argparse then.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do both. Default env, override argparse.

In VSCode I use a .env file and running the script automatically loads it for me when testing, so it's more convenient than having to keep typing it or copy/paste.

@hunterjm
Copy link
Contributor Author

hunterjm commented Oct 6, 2020

Note: We still haven't converted the lists endpoints, and don't have tests for them either.

@tuxuser
Copy link
Member

tuxuser commented Oct 6, 2020

edit - moved TODO to the top so we can edit and check off/add others as we go without losing it.

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.

None yet

5 participants