Linkedin is doing a google cloud / App Engine bloc

2019-09-11 12:16发布

问题:

I'm trying to login using LinkedIn on my site on Google App Engine. It was all working until today. Now I get a request denied error when trying to login using Linkedin. It works on the local server, it does not work on App Engine.

I'm using a boilerplate on Googles App Engine platform. I did not write this code but it has not changed so I don't think it is the code.

HTTP/1.1" 999
Error 500: No JSON object could be decoded


    elif provider_name == "linkedin":
        callback_url = "%s/social_login/%s/complete" % (self.request.host_url, provider_name)
        authentication = linkedin.LinkedInAuthentication(
            self.app.config.get('linkedin_api'),
            self.app.config.get('linkedin_secret'),
            callback_url,
            [linkedin.PERMISSIONS.BASIC_PROFILE, linkedin.PERMISSIONS.EMAIL_ADDRESS])
        authentication.authorization_code = self.request.get('code')
        access_token = authentication.get_access_token()
        link = linkedin.LinkedInApplication(authentication)
        u_data = link.get_profile(selectors=['id', 'first-name', 'last-name', 'email-address'])
        user_data = {
            'first_name': u_data.get('firstName'),
            'last_name': u_data.get('lastName'),
            'id': u_data.get('id'),
            'email': u_data.get('emailAddress')}
        self.session['linkedin'] = json.dumps(user_data)