Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GooglePlus decoder needed #176

Open
DavidHwu opened this issue Feb 24, 2015 · 1 comment
Open

GooglePlus decoder needed #176

DavidHwu opened this issue Feb 24, 2015 · 1 comment

Comments

@DavidHwu
Copy link

I believe the default decoder provided by RAuth.utils is incompatible with GooglePlus via OAuth2 decoding schema. Default RAuth decoder when used by GooglePlus, results in an empty dict {}.

I used this following decoder which seems to work just fine as I passed this into RAuth's get_auth_session() and got the desired tokens.

@staticmethod
def decoder(data: bytes, encoding: str='utf-8') -> dict:
    """
    Provide a decoder for RAuth to invoke to unpack the response and decode accordingly

    :param data: bytes
        Byte data stream that needs to be decoded (handled by this decoder)
    :param encoding: str
        Encoding for the bytes

    :return:
        Dictionary with the values returned by Google Plus

    :rtype: dict
    """
    result = data.decode(encoding)
    if result:
        json = loads(result)
        return json
    else:
        return {}
@josuebrunel
Copy link

Seems to be the same for Yahoo OAuth2. I will try this one and keep you posted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants