Python 2.7 ha raggiunto la fine del supporto
e verrà ritirato
il 31 gennaio 2026. Dopo il ritiro, non potrai eseguire il deployment di applicazioni Python 2.7, anche se la tua organizzazione ha utilizzato in precedenza un criterio dell'organizzazione per riattivare i deployment di runtime legacy. Le tue applicazioni Python 2.7 esistenti continueranno a essere eseguite e a ricevere traffico dopo la
data di ritiro. Ti consigliamo di eseguire la migrazione all'ultima versione supportata di Python.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
L'API Users fornisce funzioni per creare URL che consentono all'utente di accedere o uscire, per poi essere reindirizzato alla tua applicazione.
users.create_login_url()
e users.create_logout_url()
accettano un URL di destinazione per l'applicazione e restituiscono un URL per l'accesso o l'uscita
che reindirizza all'URL specificato in seguito.
Il server web di sviluppo simula gli Account Google utilizzando le proprie funzionalità di accesso e disconnessione.
Quando accedi alla tua applicazione sul server web di sviluppo, il server ti chiede un
indirizzo email da utilizzare per la sessione. Per saperne di più, consulta Il server web di sviluppo.
Suggerimento:un modo semplice per limitare l'accesso a una parte dell'applicazione agli
utenti che hanno eseguito l'accesso è utilizzare l'elemento di configurazione login: required per il gestore URL.
Consulta Configurazione di un'app.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThe Users API provides functions to create URLs for user sign-in and sign-out actions, redirecting them back to your application afterward.\u003c/p\u003e\n"],["\u003cp\u003e\u003ca href=\"/appengine/docs/legacy/standard/python/refdocs/google.appengine.api.users#google.appengine.api.users.create_login_url\"\u003e\u003ccode\u003eusers.create_login_url()\u003c/code\u003e\u003c/a\u003e generates a sign-in URL, while \u003ca href=\"/appengine/docs/legacy/standard/python/refdocs/google.appengine.api.users#google.appengine.api.users.create_logout_url\"\u003e\u003ccode\u003eusers.create_logout_url()\u003c/code\u003e\u003c/a\u003e generates a sign-out URL, both returning users to a specified URL.\u003c/p\u003e\n"],["\u003cp\u003eThe development web server simulates Google Accounts by using its own sign-in and sign-out system, prompting users for an email address.\u003c/p\u003e\n"],["\u003cp\u003eThis API is for first-generation App Engine standard environment runtimes; migrating to App Engine Python 3 requires different options for legacy bundled services.\u003c/p\u003e\n"]]],[],null,["# Login URLs\n\nThe Users API provides functions for constructing URLs that allow the user to sign in or sign out,\nthen be redirected back to your application.\n| This page describes how to use the legacy bundled services and APIs. This API can only run in first-generation runtimes in the App Engine standard environment. If you are updating to the App Engine Python 3 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/python-differences) to learn about your migration options for legacy bundled services.\n\n[`users.create_login_url()`](/appengine/docs/legacy/standard/python/refdocs/google.appengine.api.users#google.appengine.api.users.create_login_url)\nand [users.create_logout_url()](/appengine/docs/legacy/standard/python/refdocs/google.appengine.api.users#google.appengine.api.users.create_logout_url)\neach take a destination URL for the application, and return a URL for signing in or signing out\nthat redirects back to the given URL afterward. \n\n class MainPage(webapp2.RequestHandler):\n def get(self):\n user = users.get_current_user()\n if user:\n nickname = user.nickname()\n logout_url = users.create_logout_url('/')\n greeting = 'Welcome, {}! (\u003ca href=\"{}\"\u003esign out\u003c/a\u003e)'.format(\n nickname, logout_url)\n else:\n login_url = users.create_login_url('/')\n greeting = '\u003ca href=\"{}\"\u003eSign in\u003c/a\u003e'.format(login_url)\n self.response.write(\n '\u003chtml\u003e\u003cbody\u003e{}\u003c/body\u003e\u003c/html\u003e'.format(greeting))\n\nThe development web server simulates Google Accounts using its own sign-in and sign-out facilities.\nWhen you sign in to your application on the development web server, the server prompts you for an\nemail address to use for the session. See [The\nDevelopment Web Server](/appengine/docs/legacy/standard/python/tools/using-local-server) for more information.\n\n**Tip:** An easy way to restrict access to a part of your application to\nsigned in users is to use the `login: required` configuration element for the URL handler.\nSee [Configuring an App](/appengine/docs/legacy/standard/python/config/appref)."]]