在app引擎中使用rauth时出错(Permission denied)

Kri*_*ian 5 python google-app-engine oauth-2.0 google-plus rauth

我有一个应用程序引擎应用程序,使用oauth和rauth,我正在尝试使用Facebook,Twitter和谷歌登录.

当我在本地运行它工作,但在生产中我得到这个错误,但只有谷歌加,与Facebook工作正常.

('连接已中止.',错误(13,'权限被拒绝'))回溯(最近一次调用最后一次):文件"/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/ webapp2.py",第1535行,在调用 rv = self.handle_exception(request,response,e)文件"/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py ",第1529行,在调用 rv = self.router.dispatch(请求,响应)文件"/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py",行1278,在default_dispatcher中返回route.handler_adapter(请求,响应)文件"/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py",第1102行,在调用 返回处理程序中.dispatch()文件"/base/data/home/apps/s~app-getwell/login:1.379942143707124638/handler.py",第11行,在调度webapp2.RequestHandler.dispatch(self)文件"/ base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py",第5行 72,在调度返回self.handle_exception(e,self.app.debug)文件"/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py",第570行, in dispatch return方法(*args,**kwargs)文件"/base/data/home/apps/s~app-getwell/login:1.379942143707124638/loginToken.py",第69行,in get ep = log.getTokenData(code )文件"/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/conect.py",第34行,在getTokenData session = self.getSession(conf,code)文件"/ base /data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/conect.py",第61行,在getSession session = conf.get_auth_session(data = self.getData(code),decoder = json. load)文件"/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/service.py",第556行,get_auth_session session = self.get_session(self.get_access_token(method) ,**kwargs))文件"/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/service.py",第541行,在get_acc中 ess_token r = self.get_raw_access_token(method,**kwargs)get_raw_access_token中的文件"/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/service.py",第518行**kwargs)文件"/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/session.py",第358行,请求返回超级(OAuth2Session,self).request (方法,网址,**req_kwargs)文件"/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/requests/sessions.py",第457行,请求resp = self.send(prep,**send_kwargs)文件"/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/requests/sessions.py",第569行,发送r = adapter.send(request,**kwargs)file"/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/requests/adapters.py",第407行,发送引发ConnectionError(错误,请求=请求)ConnectionError :('连接已中止.',错误(13,'权限被拒绝'))

我启用了计费,并且在yaml中添加了ssl库(后期)

这是我进行oauth调用的代码

class login():    
    def __init__(self,tipo=tipoConexion.Google, redirect_uri =  'http://map.getwell.care/'):
        self.__tipo=tipo        
        self.config=config.data(redirect_uri)        

    def getAuthorizationURL(self):
        conf=self.getConfig()
        params=self.getParams()
        url = conf.get_authorize_url(**params)
        return url

    def getTokenData(self, code):
        ''' Get the data that i need from the provider '''
        conf=self.getConfig()
        session = self.getSession(conf,code)
        tokenizerConcreto=JsonReader.factory(self.__tipo,session)
        email=tokenizerConcreto.getEmail()[0]
        urlPic=tokenizerConcreto.getPicture()[0]
        logueado=not tokenizerConcreto.getEmail()[1]
        return logueado, urlPic, email

    def getParams(self):
        params=None
        if self.__tipo==tipoConexion.Google:            
            params = self.config.GooglePlusScope
        if self.__tipo==tipoConexion.Facebook:
            params = self.config.FacebookScope
        return params

    def getConfig(self):
        conf=self.config.googlePlus
        if self.__tipo==tipoConexion.Facebook:
            conf=self.config.facebook
        if self.__tipo==tipoConexion.Twitter:
            conf=self.config.twitter
        return conf

        def getSession(self,conf, code):
            session=None
            if self.__tipo==tipoConexion.Google:
                session=conf.get_auth_session(data=self.getData(code), decoder=json.loads)
            else:
                session=conf.get_auth_session(data=self.getData(code))
            return session        

    def getData(self,code):
        data=None
        if self.__tipo==tipoConexion.Google:
            data={
                 'code' : code,
                 'redirect_uri': self.config.redirect_uri,
                 'grant_type':'authorization_code'
             }#
            logging.info("GetWell: Data previo al error: %s" % data)
        if self.__tipo==tipoConexion.Facebook:
             data={
                 'code' : code,
                 'redirect_uri': self.config.redirect_uri,                  
             }    
        if self.__tipo==tipoConexion.Twitter:
            raise NotImplementedError
        return data
Run Code Online (Sandbox Code Playgroud)

这是我得到秘密密钥时的代码

class tipoConexion():
    Google=0
    Facebook=1
    Twitter=2

class data(object):
    def __init__(self, url =  'http://map.getwell.care/'):
        self.redirect_uri=url

    def getURL(self):
        return self.redirect_uri

    @property
    def twitter(self):
        return OAuth1Service(
            consumer_key='imnotatwitterman',
            consumer_secret='ilovevine',
            name='twitter',
            access_token_url='https://api.twitter.com/oauth/access_token',
            authorize_url='https://api.twitter.com/oauth/authorize',
            request_token_url='https://api.twitter.com/oauth/request_token',
            base_url='https://api.twitter.com/1/')

    @property
    def facebook(self):
        return OAuth2Service(
            client_id='someID',
            client_secret='MyDarkSecretInFacebook',
            name='facebook',
            authorize_url='https://graph.facebook.com/oauth/authorize',
            access_token_url='https://graph.facebook.com/oauth/access_token',
            base_url='https://graph.facebook.com/')

    @property
    def FacebookScope(self):
        return {
                'scope': 'public_profile,email',
                'response_type': 'code',
                'redirect_uri': self.getURL()
            }

    @property
    def googlePlus(self):
        return OAuth2Service(
            client_id='ThisCouldBeMyID.apps.googleusercontent.com',
            client_secret='Idonthaveanysecrets',
            name='googlePlus',
            authorize_url='https://accounts.google.com/o/oauth2/auth',
            access_token_url='https://accounts.google.com/o/oauth2/token',
            base_url='https://accounts.google.com/o/oauth2/auth')

    @property
    def GooglePlusScope(self):
        return  {
                'scope': 'https://www.googleapis.com/auth/plus.profile.emails.read',
                'response_type': 'code',
                 'redirect_uri': self.getURL()
                }
Run Code Online (Sandbox Code Playgroud)

正如我所说,最奇怪的是,与Facebook工作正常,但是,与谷歌加上失败(我doble检查client_id和client_secret并且是正确的)如果它是插座的问题,facebook也必须失败

PS.我复制项目中的rauth文件和rauth文件夹中的请求文件