Skip to content

finalize login not working properly - with fix #435

@lasgra

Description

@lasgra

I'm using steampy with steamguard, don't know if there is also problem while login with cookies or anything else.

_finalize_login function in login.py file was giving me response 403 no matter what, and what fixed it for me was adding headers, same as in _api_call function, you guys might wanna look into that.

Edit: decided to be helpful and add more info

Error message: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Different error message: requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Fix: function _finalize_login on the bottom of login.py file, file location should be in error messages, or find it by using your brain, change that function to:

def _finalize_login(self) -> Response:
    sessionid = self.session.cookies['sessionid']
    redir = f'{SteamUrl.COMMUNITY_URL}/login/home/?goto='
    finalized_data = {'nonce': self.refresh_token, 'sessionid': sessionid, 'redir': redir}
    headers = {'Referer': f'{SteamUrl.COMMUNITY_URL}/', 'Origin': SteamUrl.COMMUNITY_URL}
    return self.session.post(SteamUrl.LOGIN_URL + '/jwt/finalizelogin', data=finalized_data, headers=headers)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions