Git Product home page Git Product logo

Comments (6)

klen avatar klen commented on June 10, 2024

Are you sure?

from aioauth-client.

ei-grad avatar ei-grad commented on June 10, 2024

yep, https://github.com/klen/aioauth-client/blob/develop/aioauth_client.py#L306-L319 data is not saved anywhere

from aioauth-client.

ei-grad avatar ei-grad commented on June 10, 2024

vk.com passes the email as data['email'] there

from aioauth-client.

ei-grad avatar ei-grad commented on June 10, 2024

As access_token is saved to self.access_token, then may be we could return the whole data dict? Don't know would it break any existent code, and what about API stability...

from aioauth-client.

ei-grad avatar ei-grad commented on June 10, 2024

I use the following hack to get email for vk:

class VKClient(OAuth2Client):

    authorize_url = 'http://api.vkontakte.ru/oauth/authorize'
    access_token_url = 'https://api.vkontakte.ru/oauth/access_token'
    user_info_url = (
        'https://api.vk.com/method/users.get?fields='
        'uid,first_name,last_name,nickname,sex,bdate,city,'
        'country,timezone,photo_big'
    )
    name = 'vk'
    base_url = 'https://api.vk.com'

    @asyncio.coroutine
    def get_access_token(self, *args, **kwargs):
        ret = yield from super().get_access_token(*args, **kwargs)
        if 'email' in ret:
            self.email = ret['email']
        return ret

    @asyncio.coroutine
    def user_info(self, **kwargs):
        user, data = yield from super().user_info(**kwargs)
        if hasattr(self, 'email'):
            user.email = self.email
        return user, data

    @staticmethod
    def user_parse(data):
        """ Parse information from provider. """
        resp = data.get('response', [{}])[0]
        yield 'id', resp.get('uid')
        yield 'first_name', resp.get('first_name')
        yield 'last_name', resp.get('last_name')
        yield 'username', resp.get('nickname')
        yield 'city', resp.get('city')
        yield 'country', resp.get('country')
        yield 'picture', resp.get('photo_big')

from aioauth-client.

klen avatar klen commented on June 10, 2024

I think it's a good idea. So I've make decision to return provider's data with the tokens. The client is updated.

Thank you for the feedback.

from aioauth-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.