I have a app engine app, using oauth and rauth, i'm trying to use Facebook, Twitter and google to login.
When i run it locally works, but in production i got this error, but only with google plus, with facebook works fine.
('Connection aborted.', error(13, 'Permission denied')) Traceback (most recent call last): File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in call rv = self.handle_exception(request, response, e) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in call rv = self.router.dispatch(request, response) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher return route.handler_adapter(request, response) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in call return handler.dispatch() File "/base/data/home/apps/s~app-getwell/login:1.379942143707124638/handler.py", line 11, in dispatch webapp2.RequestHandler.dispatch(self) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch return self.handle_exception(e, self.app.debug) File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch return method(*args, **kwargs) File "/base/data/home/apps/s~app-getwell/login:1.379942143707124638/loginToken.py", line 69, in get ep=log.getTokenData(code) File "/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/conect.py", line 34, in getTokenData session = self.getSession(conf,code) File "/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/conect.py", line 61, in getSession session=conf.get_auth_session(data=self.getData(code), decoder=json.loads) File "/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/service.py", line 556, in get_auth_session session = self.get_session(self.get_access_token(method, **kwargs)) File "/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/service.py", line 541, in get_access_token r = self.get_raw_access_token(method, **kwargs) File "/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/service.py", line 518, in get_raw_access_token **kwargs) File "/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/session.py", line 358, in request return super(OAuth2Session, self).request(method, url, **req_kwargs) File "/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/requests/sessions.py", line 457, in request resp = self.send(prep, **send_kwargs) File "/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/requests/sessions.py", line 569, in send r = adapter.send(request, **kwargs) File "/base/data/home/apps/s~app-getwell/login:1.379942143707124638/code/oauth/rauth/requests/adapters.py", line 407, in send raise ConnectionError(err, request=request) ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))
I have the billing enabled, and in the yaml have added the ssl library (latests)
This is the code with wich i make the oauth calls
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
and this is the code when i got the secrets keys
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()
}
as i said the most strange is that works fine with facebook, but, fail with google plus (i doble check the client_id and the client_secret and are correct) if it was a problem with the sockets facebook would have to fail too
ps. I copy the rauth files in my project and the request files inside the rauth folder