Python 2.7 has reached end of support
and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Python 2.7
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Python
2.7 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of Python.
Stay organized with collections
Save and categorize content based on your preferences.
google.appengine.api.oauth package
Summary
OAuth API module.
Contents
- exception google.appengine.api.oauth.Errorsource
-
Bases: exceptions.Exception
Base error class for this module.
- exception google.appengine.api.oauth.InvalidOAuthParametersErrorsource
-
Bases: google.appengine.api.oauth.oauth_api.OAuthRequestError
Raised if the request was a malformed OAuth request.
For example, the request may have omitted a required parameter, contained
an invalid signature, or was made by an unknown consumer.
- google.appengine.api.oauth.get_current_user(_scope=None)source
Returns the User on whose behalf the request was made.
Parameters_scope – The custom OAuth scope or an iterable of scopes at least one of
which is accepted.
ReturnsUser
Raises
- google.appengine.api.oauth.is_current_user_admin(_scope=None)source
Returns true if the User on whose behalf the request was made is an admin.
Parameters_scope – The custom OAuth scope or an iterable of scopes at least one of
which is accepted.
Returnsboolean
Raises
- google.appengine.api.oauth.get_oauth_consumer_key()source
-
OAuth1 authentication is deprecated and turned down.
- google.appengine.api.oauth.get_client_id(_scope)source
Returns the value of OAuth2 Client ID from an OAuth2 request.
Parameters_scope – The custom OAuth scope or an iterable of scopes at least one of
which is accepted.
ReturnsThe value of Client ID.
Return typestring
Raises
- google.appengine.api.oauth.get_authorized_scopes(scope)source
Returns authorized scopes from input scopes.
Parametersscope – The custom OAuth scope or an iterable of scopes at least one of
which is accepted.
ReturnsA list of authorized OAuth2 scopes
Return typelist
Raises
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-06-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003egoogle.appengine.api.oauth\u003c/code\u003e package provides an API module for OAuth functionality within the Google App Engine environment.\u003c/p\u003e\n"],["\u003cp\u003eThis module includes several exception classes, such as \u003ccode\u003eError\u003c/code\u003e, \u003ccode\u003eOAuthRequestError\u003c/code\u003e, \u003ccode\u003eNotAllowedError\u003c/code\u003e, \u003ccode\u003eInvalidOAuthParametersError\u003c/code\u003e, \u003ccode\u003eInvalidOAuthTokenError\u003c/code\u003e, and \u003ccode\u003eOAuthServiceFailureError\u003c/code\u003e, to handle various OAuth-related issues.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eget_current_user\u003c/code\u003e function retrieves the user associated with an OAuth request, based on the provided scope, and it can raise either an \u003ccode\u003eOAuthRequestError\u003c/code\u003e or an \u003ccode\u003eOAuthServiceFailureError\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe module offers methods to check if the current user is an admin (\u003ccode\u003eis_current_user_admin\u003c/code\u003e), to get the OAuth2 Client ID (\u003ccode\u003eget_client_id\u003c/code\u003e), and to retrieve a list of authorized scopes (\u003ccode\u003eget_authorized_scopes\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThe function to get the OAuth1 consumer key, get_oauth_consumer_key, is deprecated.\u003c/p\u003e\n"]]],[],null,["# google.appengine.api.oauth package\n==================================\n\nSummary\n-------\n\nOAuth API module.\n\nContents\n--------\n\n*exception* google.appengine.api.oauth.Error[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/oauth#Error)\n\n: Bases: exceptions.Exception\n\nBase error class for this module. \n\n*exception* google.appengine.api.oauth.OAuthRequestError[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/oauth#OAuthRequestError)\n\n: Bases: [google.appengine.api.oauth.oauth_api.Error](/appengine/docs/legacy/standard/python/refdocs/google.appengine.api.oauth.oauth_api#google.appengine.api.oauth.oauth_api.Error)\n\nBase error type for invalid OAuth requests. \n\n*exception* google.appengine.api.oauth.NotAllowedError[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/oauth#NotAllowedError)\n\n: Bases: [google.appengine.api.oauth.oauth_api.OAuthRequestError](/appengine/docs/legacy/standard/python/refdocs/google.appengine.api.oauth.oauth_api#google.appengine.api.oauth.oauth_api.OAuthRequestError)\n\nRaised if the requested URL does not permit OAuth authentication. \n\n*exception* google.appengine.api.oauth.InvalidOAuthParametersError[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/oauth#InvalidOAuthParametersError)\n\n: Bases: [google.appengine.api.oauth.oauth_api.OAuthRequestError](/appengine/docs/legacy/standard/python/refdocs/google.appengine.api.oauth.oauth_api#google.appengine.api.oauth.oauth_api.OAuthRequestError)\n\n Raised if the request was a malformed OAuth request.\n\n For example, the request may have omitted a required parameter, contained\nan invalid signature, or was made by an unknown consumer. \n\n*exception* google.appengine.api.oauth.InvalidOAuthTokenError[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/oauth#InvalidOAuthTokenError)\n\n: Bases: [google.appengine.api.oauth.oauth_api.OAuthRequestError](/appengine/docs/legacy/standard/python/refdocs/google.appengine.api.oauth.oauth_api#google.appengine.api.oauth.oauth_api.OAuthRequestError)\n\n Raised if the request contained an invalid token.\n\nFor example, the token may have been revoked by the user. \n\n*exception* google.appengine.api.oauth.OAuthServiceFailureError[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/oauth#OAuthServiceFailureError)\n\n: Bases: [google.appengine.api.oauth.oauth_api.Error](/appengine/docs/legacy/standard/python/refdocs/google.appengine.api.oauth.oauth_api#google.appengine.api.oauth.oauth_api.Error)\n\nRaised if there was a problem communicating with the OAuth service. \n\ngoogle.appengine.api.oauth.get_current_user(_scope=None)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/oauth#get_current_user)\n\n: Returns the User on whose behalf the request was made.\n\n Parameters\n\n _scope -- The custom OAuth scope or an iterable of scopes at least one of\n which is accepted.\n Returns\n\n User\n Raises\n\n - [OAuthRequestError](#google.appengine.api.oauth.OAuthRequestError) -- The request was not a valid OAuth request.\n\n - [OAuthServiceFailureError](#google.appengine.api.oauth.OAuthServiceFailureError) -- An unknown error occurred.\n\ngoogle.appengine.api.oauth.is_current_user_admin(_scope=None)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/oauth#is_current_user_admin)\n\n: Returns true if the User on whose behalf the request was made is an admin.\n\n Parameters\n\n _scope -- The custom OAuth scope or an iterable of scopes at least one of\n which is accepted.\n Returns\n\n boolean\n Raises\n\n - [OAuthRequestError](#google.appengine.api.oauth.OAuthRequestError) -- The request was not a valid OAuth request.\n\n - [OAuthServiceFailureError](#google.appengine.api.oauth.OAuthServiceFailureError) -- An unknown error occurred.\n\ngoogle.appengine.api.oauth.get_oauth_consumer_key()[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/oauth#get_oauth_consumer_key)\n\n: OAuth1 authentication is deprecated and turned down.\n\ngoogle.appengine.api.oauth.get_client_id(_scope)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/oauth#get_client_id)\n\n: Returns the value of OAuth2 Client ID from an OAuth2 request.\n\n Parameters\n\n _scope -- The custom OAuth scope or an iterable of scopes at least one of\n which is accepted.\n Returns\n\n The value of Client ID.\n Return type\n\n string\n Raises\n\n - [OAuthRequestError](#google.appengine.api.oauth.OAuthRequestError) -- The request was not a valid OAuth2 request.\n\n - [OAuthServiceFailureError](#google.appengine.api.oauth.OAuthServiceFailureError) -- An unknown error occurred.\n\ngoogle.appengine.api.oauth.get_authorized_scopes(scope)[source](/appengine/docs/legacy/standard/python/refdocs/modules/google/appengine/api/oauth#get_authorized_scopes)\n\n: Returns authorized scopes from input scopes.\n\n Parameters\n\n scope -- The custom OAuth scope or an iterable of scopes at least one of\n which is accepted.\n Returns\n\n A list of authorized OAuth2 scopes\n Return type\n\n list\n Raises\n\n - [OAuthRequestError](#google.appengine.api.oauth.OAuthRequestError) -- The request was not a valid OAuth2 request.\n\n - [OAuthServiceFailureError](#google.appengine.api.oauth.OAuthServiceFailureError) -- An unknown error occurred"]]