Created
          January 16, 2023 17:07 
        
      - 
      
- 
        Save asilbalaban/a750cf7af1fa757b4bae7b870db0f6c4 to your computer and use it in GitHub Desktop. 
Revisions
- 
        asilbalaban revised this gist Jan 16, 2023 . 1 changed file with 0 additions and 10 deletions.There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -11,16 +11,6 @@ def getSalt(email): return response.json()["salt"] def login(hashedPassword, email, aud): headers = { 'content-type': 'application/json', } 
- 
        asilbalaban created this gist Jan 16, 2023 .There are no files selected for viewingThis 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ 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): """ curl 'https://api.sorare.com/graphql' \ -H 'content-type: application/json' \ -d '{ "operationName": "SignInMutation", "variables": { "input": { "email": "<YourEmail>", "password": "<YourHashPassword>" } }, "query": "mutation SignInMutation($input: signInInput!) { signIn(input: $input) { currentUser { slug jwtToken(aud: \"<YourAud>\") { token expiredAt } } errors { message } } }" }' """ 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)