% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/login.R
\name{dse_set_gdal_token}
\alias{dse_set_gdal_token}
\title{Set Copernicus Data Space Ecosystem Access Token for GDAL Driver}
\usage{
dse_set_gdal_token(token = dse_public_access_token())
}
\arguments{
\item{token}{For authentication, many of the Data Space Ecosystem uses
an access token. Either provide your access token, or obtain one automatically
with \code{\link[=dse_access_token]{dse_access_token()}} (default). Without a valid token you will likely get
an "access denied" error.}
}
\value{
Returns a \code{logical} value. \code{TRUE} if all variables
were successfully set. \code{FALSE} otherwise.
}
\description{
This function sets system environment variables, such
that the GDAL library can access the Copernicus Data Space
Ecosystem https storage. Note that these settings can be used
by any package depending on the GDAL library. Most notably:
\code{stars}, \code{terra}, and \code{gdalraster}.
}
\examples{
if (interactive() && dse_has_client_info() &&
    requireNamespace("stars")) {
  uri <-
    dse_stac_get_uri(
      "S2A_MSIL1C_20260109T132741_N0511_R024_T39XVL_20260109T142148",
      "B01", type = "odata")
   
  dse_set_gdal_token()

  ## As this URI is zipped, it need to be downloaded.
  ## But you can access it directly:
  jp2 <- stars::read_stars(uri)
}
}
\seealso{
Other authentication:
\code{\link[=dse_access_token]{dse_access_token()}},
\code{\link[=dse_get_token_details]{dse_get_token_details()}},
\code{\link[=dse_has_s3_secret]{dse_has_s3_secret()}},
\code{\link[=dse_usage]{dse_usage()}}
}
\concept{authentication}
