Skip to content

API requests to get_targets using API token doesn't return data #1396

@JustScreaMy

Description

@JustScreaMy

Trying to use API with API Token to get all available targets always return empty array, but using session works.

curl --request GET \
  --url "https://WARPGATE_DOMAIN/@warpgate/api/targets?search=" \
  --header 'Accept: application/json; charset=utf-8' \
  --header 'X-Warpgate-Token: WARPGATE_API_TOKEN' -v

Always returns HTTP 200, but empty array as a response

[]

Trying to use warpgate-http-session for auth (request copied from network tab in browser) works normally

curl 'https://WARPGATE_DOMAIN/@warpgate/api/targets?search=' \
  -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:139.0) Gecko/20100101 Firefox/139.0' \
  -H 'Accept: */*' \
  -H 'Accept-Language: en-US,en;q=0.5' \
  -H 'Accept-Encoding: gzip, deflate, br, zstd' \
  -H 'Referer: https://WARPGATE_DOMAIN/@warpgate' \
  -H 'Connection: keep-alive' \
  -H 'Cookie: warpgate-http-session=WARPGATE_HTTP_SESSION' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'DNT: 1' \
  -H 'Sec-GPC: 1' \
  -H 'Priority: u=4' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'TE: trailers'

Warpgate version: v0.14.1-8-g2ef3553

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions