0

我正在关注 Heroku-Facebook 应用程序教程,但在尝试在 Facebook 中查看我的应用程序时出现错误。与默认应用主页相反,屏幕上会出现以下错误和回溯。

TypeError
TypeError: Incorrect padding

Traceback (most recent call last)

File "/app/lib/python2.7/site-packages/flask/app.py", line 1306, in __call__
return self.wsgi_app(environ, start_response)

File "/app/lib/python2.7/site-packages/flask/app.py", line 1294, in wsgi_app
response = self.make_response(self.handle_exception(e))

File "/app/lib/python2.7/site-packages/flask/app.py", line 1292, in wsgi_app
response = self.full_dispatch_request()

File "/app/lib/python2.7/site-packages/flask/app.py", line 1062, in full_dispatch_request
rv = self.handle_user_exception(e)

File "/app/lib/python2.7/site-packages/flask/app.py", line 1060, in full_dispatch_request
rv = self.dispatch_request()

File "/app/lib/python2.7/site-packages/flask/app.py", line 1047, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)

File "/app/exampleap

修复此错误需要采取哪些具体步骤?

4

1 回答 1

6

在您的应用程序中,更改此行:

data = json.loads(urlsafe_b64decode(str(encoded_data[1])))

进入这一行:

data = json.loads(urlsafe_b64decode(str(encoded_data[1]) + (64-len(encoded_data[1])%64)*"="))

这个对我有用

于 2012-05-01T03:14:15.893 回答