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 835589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:50:52+00:00 2026-05-15T04:50:52+00:00

I’ve recently tried to switch my app engine app to using openID, but I’m

  • 0

I’ve recently tried to switch my app engine app to using openID, but I’m having an issue authenticating with remote_api. The old authentication mechanism for remote_api doesn’t seem to work (which makes sense) – I’m getting a ‘urllib2.HTTPError: HTTP Error 302: Found’, which I assume is appengine redirecting me to the openid login page I’ve set up.

I guess I’m missing something fairly obvious. Currently my remote_api script has the following in it –

remote_api_stub.ConfigureRemoteDatastore(app_id=app_id, path='/remote_api', auth_func=auth_func, servername=host, secure=secure)

where auth_func is

def auth_func():
  return raw_input('Username:'), getpass.getpass('Password:')

Any ideas what I need to supply to remote_api? I guess similar issues would be encountered with bulkloader too. Cheers,

Colin

  • 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-05-15T04:50:53+00:00Added an answer on May 15, 2026 at 4:50 am

    This was a fun one.

    Looking at remote_api, the flow for authentication seems to be something like this:

    • Prompt the user for Google credentials
    • Post the credentials to https://www.google.com/accounts/ClientLogin
    • Parse the auth token out of the response body
    • Pass the token to https://myapp.appspot.com/_ah/login
    • Grab ACSID cookie set in the response
    • Pass the ACSID cookie in subsequent requests that require authorization

    I couldn’t find a lot of documentation on the new OpenID support, though Nick’s blog entry was informative.

    Here’s the test app I wrote to see how things work:

    app.yaml:

    handlers:
    - url: /remote_api
      script: $PYTHON_LIB/google/appengine/ext/remote_api/handler.py
      login: admin
    - url: /.*
      script: test.py
    

    test.py:

    class MainPage(webapp.RequestHandler):
      def get(self):
        user = users.get_current_user()
        if user:
          self.response.out.write("Hi, %s!<hr>admin is %s" % (user.user_id(),
            users.is_current_user_admin()))
        else:
          self.redirect(users.create_login_url('/', None,
            'https://www.google.com/accounts/o8/id'))
    

    Flipping my auth mode between Google Accounts and Federated Login, I noticed a few things:

    • Admin users are correctly recognized by is_current_user_admin() with OpenID
    • Mixing modes doesn’t work. With authentication set to Google Accounts, calling create_login_url with a federated_identity throws a NotAllowedError
    • An ACSID cookie is still produced at the end of the login process, only it comes from /_ah/openid_verify instead of /_ah/login

    So what’s happening with remote_api when using Federated Login? If we’re using the default appengine_rpc.HttpRpcServer, it’s dutifully following the same Google Account authentication process described at the top, only the app no longer considers the ACSID cookie returned by /_ah/login to be valid, so since you’re still unauthenticated, you get a 302 redirect to the OpenID login page, /_ah/login_required.

    I dunno what the right solution is here. Seems like it would require an API update. Maybe Nick or one of the other Googlers can weigh in.

    For now, here’s a hacky workaround:

    • Turn on Federated Login for your app
    • Make sure you’re passing save_cookies=True when calling remote_api_stub.ConfigureRemoteDatastore for your console script
    • Attempt console authentication and get the 302 error
    • Login as an admin via your app’s web interface
    • In your browser cookies, find the ACSID cookie for myapp.appspot.com
    • Find and edit your local ~/.appcfg_cookies file
    • Replace the ACSID cookie for myapp.appspot.com with the one from your browser

    The next time you try to use remote_api, it should work without prompting for credentials. You’ll have to repeat the last 4 steps every time the cookie expires, though. You can bump the expiration from 1 day to as high as 2 weeks in the admin console to minimize the annoyance. Have fun!

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

Sidebar

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.