Created
January 16, 2023 17:07
-
-
Save asilbalaban/a750cf7af1fa757b4bae7b870db0f6c4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import bcrypt | |
""" | |
pip3 install bcrypt | |
""" | |
def getSalt(email): | |
url = "https://api.sorare.com/api/v1/users/" + email | |
response = requests.get(url) | |
return response.json()["salt"] | |
def login(hashedPassword, email, aud): | |
headers = { | |
'content-type': 'application/json', | |
} | |
json_data = { | |
'operationName': 'SignInMutation', | |
'variables': { | |
'input': { | |
'email': email, | |
'password': hashedPassword.decode('utf-8'), | |
}, | |
}, | |
'query': 'mutation SignInMutation($input: signInInput!) { signIn(input: $input) { currentUser { slug jwtToken(aud: "'+aud+'") { token expiredAt } } errors { message } } }', | |
} | |
response = requests.post('https://api.sorare.com/graphql', headers=headers, json=json_data) | |
return response.json() | |
if __name__ == "__main__": | |
aud = "<your-aud>" | |
email = "<your-email>" | |
password = "<your-password>".encode('utf-8') | |
salt = getSalt(email).encode('utf-8') | |
hashedPassword = bcrypt.hashpw(password, salt) | |
response = login(hashedPassword, email, aud) | |
print(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment