Abrufen des Fehlers: redirect_uri_mismatch Der Umleitungs-URI in der Anforderung: http: // localhost: 8080 / oauth2callback stimmte nicht mit einem registrierten Umleitungs-URI überein
Ich erhalte diesen Fehler beim Versuch, meine Anwendung auszuführen ...
The redirect URI in the request: http://localhost:8080/oauth2callback did not match a registered redirect URI
In der Google API-Konsole habe ich meine Weiterleitungs-URLs registriert
Redirect URIs: http://localhost:8080/
Und in der client_secrets.json verwende ich auch das gleiche wie die Weiterleitungs-URL, die ich diesem Tutorial folgehttps://developers.google.com/bigquery/articles/dashboard#addoauth2
Bearbeiten:
Ich habe gerade einige Änderungen am vorhandenen Code vorgenommen
Jetzt die
redirect URIs in API console is http://localhost:8080/oauth2callback
Und hier ist meine 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
Jetzt wird zwar kein Fehler angezeigt, aber es wird eine leere Seite angezeigt.
Hier ist meine 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()
Wenn also alles in Ordnung ist, muss laut main.py Hello Dashboard gedruckt werden, ist es aber nicht