Skip to content

Commit

Permalink
Temporal fix for notebook authenticate
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Jan 10, 2024
1 parent eb01060 commit d95c0a0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions geemap/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

def ee_initialize(
token_name="EARTHENGINE_TOKEN",
auth_mode="notebook",
auth_mode=None,
service_account=False,
auth_args={},
user_agent_prefix="geemap",
Expand All @@ -44,7 +44,8 @@ def ee_initialize(

Args:
token_name (str, optional): The name of the Earth Engine token. Defaults to "EARTHENGINE_TOKEN".
auth_mode (str, optional): The authentication mode, can be one of paste,notebook,gcloud,appdefault. Defaults to "notebook".
auth_mode (str, optional): The authentication mode, can be one of colab, notebook, localhost, or gcloud.
See https://developers.google.com/earth-engine/guides/auth for more details. Defaults to None.
service_account (bool, optional): If True, use a service account. Defaults to False.
auth_args (dict, optional): Additional authentication parameters for aa.Authenticate(). Defaults to {}.
user_agent_prefix (str, optional): If set, the prefix (version-less) value used for setting the user-agent string. Defaults to "geemap".
Expand All @@ -58,6 +59,12 @@ def ee_initialize(
if "http_transport" not in kwargs:
kwargs["http_transport"] = httplib2.Http()

if auth_mode is None:
if in_colab_shell():
auth_mode = "colab"
else:
auth_mode = "localhost"

auth_args["auth_mode"] = auth_mode

if ee.data._credentials is None:
Expand Down

0 comments on commit d95c0a0

Please sign in to comment.