python 重定向 网址错_python – 获取错误:redirect_uri_mismatch请求中的重定向URI:http:// localhost:8080 / oauth2callback...

尝试运行我的应用程序时收到此错误…

The redirect URI in the request: http://localhost:8080/oauth2callback did not match a registered redirect URI

在Google API控制台中,我已经注册了我的重定向网址

Redirect URIs: http://localhost:8080/

编辑:

我只是对现有的代码进行了一些修改

现在

redirect URIs in API console is http://localhost:8080/oauth2callback

这里是我的app.yaml

application: hellomydashboard

version: 1

runtime: python

api_version: 1

handlers:

- url: /favicon\.ico

static_files: favicon.ico

upload: favicon\.ico

- url: /oauth2callback

script: oauth2client/appengine.py

- url: .*

script: main.py

现在虽然它没有显示任何错误,但它显示一个空白页.

这是我的main.py

from bqclient import BigQueryClient

import httplib2

import os

from google.appengine.api import memcache

from google.appengine.ext import webapp

from google.appengine.ext.webapp.util import run_wsgi_app

from oauth2client.appengine import oauth2decorator_from_clientsecrets

# Project ID for project to receive bill.

# During limited availability preview, there is no bill.

# The value should be your quoted Client ID number

# which you previously recorded from code.google.com/apis/console

# REPLACE THIS NUMBER WITH YOUR CLIENT ID

PROJECT_ID = "My Project ID" #i just replaced dat

DATASET = "samples"

TABLE = "natality"

# CLIENT_SECRETS, name of a file containing the OAuth 2.0

# information for this application.

CLIENT_SECRETS = os.path.join(os.path.dirname(__file__),

'client_secrets.json')

http = httplib2.Http(memcache)

decorator = oauth2decorator_from_clientsecrets(CLIENT_SECRETS,

'https://www.googleapis.com/auth/bigquery')

bq = BigQueryClient(http, decorator)

class MainHandler(webapp.RequestHandler):

@decorator.oauth_required

def get(self):

self.response.out.write("Hello Dashboard!\n")

application = webapp.WSGIApplication([

('/', MainHandler),

], debug=True)

def main():

run_wsgi_app(application)

if __name__ == '__main__':

main()

所以根据main.py,如果一切都很好,它必须打印Hello Dashboard,但它不是

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值