Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All API calls end up as not authorized although the credentials are correct #254

Open
not-important-vr opened this issue Jan 21, 2025 · 2 comments

Comments

@not-important-vr
Copy link

It seems API calls are currently broken?
Same credentials work fine for logging in over the browser.

Curl example used:
curl -u apollo:12345678 -X POST -k https://localhost:47990/api/clients/unpair-all

See below screenshot for more details:

Image

@ClassicOldSong
Copy link
Owner

Basic auth has been removed in Apollo and you need to use cookies now.

There will be an access token feature in a recent update for API calls.

@temancl
Copy link

temancl commented Jan 22, 2025

I just noticed this yesterday messing around and hacked up some powershell that successfully passes the auth cookie.


# Perform the login request
$response = Invoke-WebRequest -Method Post -Uri "https://localhost:47990/api/login" `
  -Body (@{username="apollo"; password="foobarpassword"} | ConvertTo-Json -Depth 1) `
  -ContentType "application/json" `
  -SkipCertificateCheck -Verbose

# Extract the 'Set-Cookie' header from the response
$setCookie = $response.Headers["Set-Cookie"]
# Print the cookie to the console
$cookieValue = $setCookie -split ';' | Select-Object -First 1

Write-Output "Set-Cookie: $cookieValue"

# Make the POST request to /api/restart with the cookie
$responseRestart = Invoke-RestMethod -Method Post -Uri "https://localhost:47990/api/restart" `
  -Headers @{ "Cookie" = $cookieValue } `
  -Authentication Basic -Credential (New-Object PSCredential("apollo", (ConvertTo-SecureString "foobarpassword" -AsPlainText -Force))) `
  -SkipCertificateCheck -Verbose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants