Example #1
0
 def __init__(self, resource_owner_key, resource_owner_secret, **kwargs):
     client_id = get_config('socialite.SOCIAL_AUTH_TWITTER_KEY')
     client_secret = get_config('socialite.SOCIAL_AUTH_TWITTER_SECRET')
     self.oauth_session = BaseOAuth1(
         client_id,
         client_secret=client_secret,
         resource_owner_key=resource_owner_key,
         resource_owner_secret=resource_owner_secret)
     self.oauth_session.BASE_URL = 'https://api.twitter.com'
Example #2
0
 def _get_redirect_uri(self):
     self.backend_str = self.name
     if '-' in self.name:
         self.backend_str = "_".join(self.name.split("-"))
     return self._format_redirect(get_config(
         'socialite.SOCIAL_AUTH_{provider_name}_REDIRECT_URI'.format(provider_name=self.backend_str.upper()))
     )
Example #3
0
    def _format_redirect(self, redirect: str):
        if not redirect:
            raise InvalidRedirectUriError(
                'SOCIAL_AUTH_{provider_name}_REDIRECT_URI '
                'doesn\'t exists'.format(provider_name=self.backend_str.upper())
            )

        if redirect.startswith('/'):
            app_url = get_config('application.URL')
            redirect = '{url}{redirect}'.format(url=app_url, redirect=redirect) if app_url.endswith('/') \
                else '{app_url}/{redirect}'.format(app_url=app_url, redirect=redirect)
        return redirect
Example #4
0
 def request_host(self):
     return get_config('application.URL')
 def __init__(self, token, **kwargs):
     client_id = get_config('socialite.SOCIAL_AUTH_GITHUB_KEY')
     self.oauth_session = BaseOAuth2(client_id, token=token)
     self.oauth_session.BASE_URL = 'https://api.github.com'
Example #6
0
 def __init__(self, token, **kwargs):
     client_id = get_config("socialite.SOCIAL_AUTH_Amazon_KEY")
     self.oauth_session = BaseOAuth2(client_id, token=token)
     self.oauth_session.BASE_URL = "https://api.amazon.com"
Example #7
0
 def __init__(self, token, **kwargs):
     client_id = get_config('socialite.SOCIAL_AUTH_GOOGLE_OAUTH2_KEY')
     self.oauth_session = BaseOAuth2(client_id, token=token)
     self.oauth_session.BASE_URL = 'https://www.googleapis.com'
 def __init__(self, token):
     client_id = get_config('socialite.SOCIAL_AUTH_FACEBOOK_KEY')
     self.oauth_session = BaseOAuth2(client_id, token=token)
     self.oauth_session.BASE_URL = 'https://graph.facebook.com'
 def __init__(self, token, **kwargs):
     client_id = get_config('socialite.SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY')
     self.oauth_session = BaseOAuth2(client_id, token=token)
     self.oauth_session.BASE_URL = 'https://api.linkedin.com'