Skip To Content



Returns token information when signed in to or a local portal.


The GetSigninToken function will return the token and expiration information when signed in to a portal. This function should be used within a desktop application, either from the Python window or a script tool executed from within the application as it returns the token from the desktop session. If run from a stand-alone script, or the application is not signed in, the function will return None. The token can be used by urllib calls to authenticate with services through REST.


GetSigninToken ()
Return Value
Data TypeExplanation

A dictionary of key value pairs for token, referer, expires, and messages.

Code sample

GetSigninToken example

Get and print a token within the Python window.

import arcpy

token = arcpy.GetSigninToken()
if token is not None: