https://github.com/simon-weber/gpsoauth
A python client library for Google Play Services OAuth.
https://github.com/simon-weber/gpsoauth
Last synced: 3 months ago
JSON representation
A python client library for Google Play Services OAuth.
- Host: GitHub
- URL: https://github.com/simon-weber/gpsoauth
- Owner: simon-weber
- License: mit
- Created: 2015-05-13T21:11:52.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2024-06-10T01:18:18.000Z (about 1 year ago)
- Last Synced: 2024-10-02T18:36:40.399Z (10 months ago)
- Language: Python
- Size: 97.7 KB
- Stars: 95
- Watchers: 14
- Forks: 31
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# gpsoauth
[](https://github.com/simon-weber/gpsoauth/actions/workflows/ci.yaml)
[](https://pypi.org/project/gpsoauth/)
[](https://www.repominder.com)**Python client library for Google Play Services OAuth.**
`gpsoauth` allows python code to use the "master token" flow that KB Sriram described at
.```python
import gpsoauthemail = '[email protected]'
password = 'my-password'
android_id = '0123456789abcdef'master_response = gpsoauth.perform_master_login(email, password, android_id)
master_token = master_response['Token']auth_response = gpsoauth.perform_oauth(
email, master_token, android_id,
service='sj', app='com.google.android.music',
client_sig='...')
token = auth_response['Auth']
```This can be useful when writing code that poses as a Google app, like
[gmusicapi does here](https://github.com/simon-weber/gmusicapi/blob/87a802ab3a59a7fa2974fd9755d59a55275484d9/gmusicapi/session.py#L267-L278).Many thanks to Dima Kovalenko for reverse engineering the EncryptedPasswd signature in
.For an explanation of recent changes, see [the changelog](https://github.com/simon-weber/gpsoauth/blob/master/CHANGELOG.md).
## Alternative flow
There is an alternative login flow if you are experiencing `BadAuthentication` errors.
1. Go to https://accounts.google.com/EmbeddedSetup
2. Log into your Google Account
3. Click on "I agree" when prompted. The page may show a loading screen forever; ignore it and move on to the next step.
4. Obtain the value of the `oauth_token` cookie. For more details see [the gpsoauth-java readme](https://github.com/rukins/gpsoauth-java/blob/b74ebca999d0f5bd38a2eafe3c0d50be552f6385/README.md#receiving-an-authentication-token).Then, perform the token exchange:
```python
import gpsoauthemail = '[email protected]'
android_id = '0123456789abcdef'
token = '...' # insert the oauth_token heremaster_response = gpsoauth.exchange_token(email, token, android_id)
master_token = master_response['Token'] # if there's no token check the response for more detailsauth_response = gpsoauth.perform_oauth(
email, master_token, android_id,
service='sj', app='com.google.android.music',
client_sig='...')
token = auth_response['Auth']
```## Ports
- C\#:
- Ruby:
- Java:
- C++: and## Contributing
See [Contributing guidelines](https://github.com/simon-weber/gpsoauth/blob/master/CONTRIBUTING.md).
This is an open-source project and all contributions are highly welcomed.