def create_oauth_app(service_config, name): upper_name = name.upper() app.config[upper_name] = service_config service_oauth = oauth.OAuth() service_app = service_oauth.remote_app(name, app_key=upper_name) service_oauth.init_app(app) return service_app
def create_oauth_app(service_config, name): """Creates oauth app for particaular web service Args: service_config (dict): config required for creating oauth app name (string): name of the service, e.g github """ upper_name = name.upper() app.config[upper_name] = service_config service_oauth = oauth.OAuth() service_app = service_oauth.remote_app(name, app_key=upper_name) service_oauth.init_app(app) return service_app
"""Authentication module.""" import flask import functools import logging from flask_oauthlib import client as f_oauth_client from flask_oauthlib import provider from oauthlib import common as oauth_common from oauthlib import oauth2 as oauth_oauth2 from eucaby_api import models from eucaby_api import args as api_args from eucaby_api.utils import gae as gae_utils from eucaby_api.utils import utils as api_utils oauth = f_oauth_client.OAuth() # Client for remote APIs GRANT_TYPE_PASSWORD = '******' GRANT_TYPE_REFRESH = 'refresh_token' GRANT_TYPE_CHOICES = [GRANT_TYPE_PASSWORD, GRANT_TYPE_REFRESH] class FacebookRemoteApp(f_oauth_client.OAuthRemoteApp): """Facebook remote app.""" def __init__(self, oauth_, **kwargs): super(FacebookRemoteApp, self).__init__( oauth_, models.FACEBOOK, **kwargs) def exchange_token(self, token):