OpenXbox / xbox-webapi-python

A python library to authenticate with Xbox Live via your Microsoft Account and provides Xbox related Web-API.
https://pypi.python.org/pypi/xbox-webapi
MIT License
175 stars 44 forks source link

Unable to run xbox-authenticate due to error in OAuth2TokenResponse #60

Closed proffalken closed 3 years ago

proffalken commented 3 years ago

Pretty much as the title says - if I try and run xbox-authenticate, the code fails with the following error:

(xbl) [mmw@rincewind ~]$ xbox-authenticate --client-id <CLIENT_ID> --client-secret <CLIENT_SECRET>
Traceback (most recent call last):
  File "/home/mmw/.virtualenvs/xbl/bin/xbox-authenticate", line 8, in <module>
    sys.exit(main())
  File "/home/mmw/.virtualenvs/xbl/lib/python3.7/site-packages/xbox/webapi/scripts/authenticate.py", line 97, in main
    async_main(args.client_id, args.client_secret, args.redirect_uri, args.tokens)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
    return future.result()
  File "/home/mmw/.virtualenvs/xbl/lib/python3.7/site-packages/xbox/webapi/scripts/authenticate.py", line 45, in async_main
    auth_mgr.oauth = OAuth2TokenResponse.parse_raw(tokens)
  File "pydantic/main.py", line 601, in pydantic.main.BaseModel.parse_raw
  File "pydantic/main.py", line 578, in pydantic.main.BaseModel.parse_obj
  File "pydantic/main.py", line 406, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 5 validation errors for OAuth2TokenResponse
token_type
  field required (type=value_error.missing)
expires_in
  field required (type=value_error.missing)
scope
  field required (type=value_error.missing)
access_token
  field required (type=value_error.missing)
user_id
  field required (type=value_error.missing)

I've tried this with virtualenvs running python 3.9 and python 3.7 so I don't believe it's a python version issue

OS is Arch Linux, however ideally I'd want to run this in a Docker Container.

proffalken commented 3 years ago

I was able to authenticate using the REST API Docs, closing this.