'Since there are different OAuth API\'s with different ways to
retrieve user info'

def get_oauth_user_info(self, provider, resp=None):

    if ((provider == 'github') or (provider == 'githublocal')):
        me = self.appbuilder.sm.oauth_remotes[provider].get('user')
        log.debug('User    info    from    Github:    {0}'.format(me.data))
        return {'username': ('github_' + me.data.get('login'))}
    if (provider == 'twitter'):
        me = self.appbuilder.sm.oauth_remotes[provider].get('account/settings.json')
        log.debug('User    info    from    Twitter:    {0}'.format(me.data))
        return {'username': ('twitter_' + me.data.get('screen_name', ''))}
    if (provider == 'linkedin'):
        me = self.appbuilder.sm.oauth_remotes[provider].get('people/~:(id,email-address,first-name,last-name)?format=json')
        log.debug('User    info    from    Linkedin:    {0}'.format(me.data))
        return {'username': ('linkedin_' + me.data.get('id', '')), 'email': me.data.get('email-address', ''), 'first_name': me.data.get('firstName', ''), 'last_name': me.data.get('lastName', '')}
    if (provider == 'google'):
        me = self.appbuilder.sm.oauth_remotes[provider].get('userinfo')
        log.debug('User    info    from    Google:    {0}'.format(me.data))
        return {'username': ('google_' + me.data.get('id', '')), 'first_name': me.data.get('given_name', ''), 'last_name': me.data.get('family_name', ''), 'email': me.data.get('email', '')}
    else:
        return {}
