Geolocation from IP address

Hi,
I am running a shiny app on shinyapps.io and I would like to geolocate the users, ie guess their location so they dont have to enter it manually. I am using the following code:

      # Get IP address
      if(exists(x="HTTP_X_FORWARDED_FOR", envir=session$request)){
        current.ip <- base::get(x="HTTP_X_FORWARDED_FOR", envir=session$request)
      } else {
        current.ip <- "0.0.0.0"
        }
      
      # Get Geolocation
      res  <- GET(paste0("http://api.ipstack.com/",current.ip,"?access_key=",config::get("ipstackkey")))
      data <- fromJSON(rawToChar(res$content))

If I assign a fixed IP address to current.ip the geolocation works fine. However, I cannot seem to be able to retrieve the user IP.

Any help is welcome!

Best, Wilmar