Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9091531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:37:58+00:00 2026-06-16T22:37:58+00:00

I was using the Python OAuth2 decorator in my Google App Engine application. I

  • 0

I was using the Python OAuth2 decorator in my Google App Engine application. I downloaded the client secrets as a json file from API console. After deploying the app to appspot.com, the local version (localhost:8080) isn’t working. The call to decorator.has_credentials() returns false. The appspot version works fine.

UPDATE: Code snippet (simplified)

CLIENT_SECRETS = os.path.join(os.path.dirname(__file__), 'client_secrets.json')

oauth2_decorator = oauth2decorator_from_clientsecrets(
    CLIENT_SECRETS,
    scope='https://www.googleapis.com/auth/calendar',
    message=MISSING_CLIENT_SECRETS_MESSAGE)


class MyRequestHandler(webapp2.HandleRequest):
  @oauth2_decorator.oauth_aware
  def get(self):
    if oauth2_decorator.has_credentials():
      # do stuff...
    else:
      self.out.write("<html><body>Invalid credentials</body></html>")


app = webapp2.WSGIApplication([
    ('/', MyRequestHandler),
    (oauth2_decorator.callback_path, oauth2_decorator.callback_handler())
], debug=True)

UPDATE 2: This is the content of my client_secrets.json, without sensible information

{"web":  
  {
    "auth_uri":"https://accounts.google.com/o/oauth2/auth",
    "client_secret":"MY_CLIENT_SECRET",
    "token_uri":"https://accounts.google.com/o/oauth2/token",
    "client_email":"MY_CLIENT_ID@developer.gserviceaccount.com",
    "redirect_uris":[
      "http://MY_APP_NAME.appspot.com",
      "http://localhost:8080"
    ],    
    "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/MY_CLIENT_ID@developer.gserviceaccount.com",
    "client_id":"MY_CLIENT_ID.apps.googleusercontent.com",
    "auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs",
    "javascript_origins":[
      "http://MY_APP_NAME.appspot.com",
      "http://localhost:8080"
    ]
  }
}

I’m getting “Invalid credentials” in my local machine. Works fine in appspot.com. It worked in my machine before deploying in appspot.

What can be happening?

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:38:00+00:00Added an answer on June 16, 2026 at 10:38 pm

    Ok, I was so stupid. I forgot to provide an authorization link to the user for the first time, instead of an error.

    CLIENT_SECRETS = os.path.join(os.path.dirname(__file__), 'client_secrets.json')
    
    oauth2_decorator = oauth2decorator_from_clientsecrets(
        CLIENT_SECRETS,
        scope='https://www.googleapis.com/auth/calendar',
        message=MISSING_CLIENT_SECRETS_MESSAGE)
    
    
    class MyRequestHandler(webapp2.HandleRequest):
      @oauth2_decorator.oauth_aware
      def get(self):
        if oauth2_decorator.has_credentials():
          # do stuff...
        else:
          self.out.write(oauth2_decorator.authorize_url())
    
    
    app = webapp2.WSGIApplication([
        ('/', MyRequestHandler),
        (oauth2_decorator.callback_path, oauth2_decorator.callback_handler())
    ], debug=True)
    

    Now it’s working fine :-).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to access a google app through the Python Client using this code
I'm developing a Google App Engine app with Python. And I'm using: Google Calendar
I implemented the experimental OAuth support for Google App Engine using Python, and have
I use the Google APIs Client Library for Python (oauth2client app engine). When the
What possible ways to import google contacts using python and oauth2.0 exists? We successfully
I am trying to get Oauth working with the Google API using Python. I
I am trying to implement Oauth in google app engine on python. For my
I'm trying to authenticate a python command line script agains my app engine application
I have an Android client that needs to authenticate with a python Google App
Using Python's csv module, is it possible to read an entire, large, csv file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.