def process_error(self, data):
     if data.get('error'):
         error = self.data.get('error_description') or self.data['error']
         raise AuthFailed(self, error)
Beispiel #2
0
 def _user_id(self, response):
     match = STEAM_ID.search(response.identity_url)
     if match is None:
         raise AuthFailed(self, 'Missing Steam Id')
     return match.group(1)
Beispiel #3
0
 def process_error(self, data):
     error = data.get("error_description") or data.get("error")
     if error:
         raise AuthFailed(self, error)
            self.shopifyAPI.Session.setup(
                api_key=setting('SHOPIFY_APP_API_KEY'),
                secret=setting('SHOPIFY_SHARED_SECRET'))
            shopify_session = self.shopifyAPI.Session(shop_url,
                                                      self.request.REQUEST)
            access_token = shopify_session.token
        except self.shopifyAPI.ValidationException, e:
            raise AuthCanceled(self)
        except HTTPError, e:
            if e.code == 400:
                raise AuthCanceled(self)
            else:
                raise

        if not access_token:
            raise AuthFailed(self, 'Authentication Failed')
        return self.do_auth(access_token, shop_url, shopify_session.url, *args,
                            **kwargs)

    def do_auth(self, access_token, shop_url, website, *args, **kwargs):
        kwargs.update({
            'auth': self,
            'response': {
                'shop': shop_url,
                'website': 'http://%s' % website,
                'access_token': access_token
            },
            self.AUTH_BACKEND.name: True
        })
        return authenticate(*args, **kwargs)