AdguardTeam / AdguardTeam/AdGuardDNS

API Issue: 401 Unauthorized when accessing parental/web_services endpoint

Aperta
#1,041 5 commenti 0 reazioni 1 assegnatario Rivendicata da @Chinaski1 Vedi su GitHub
feature request
Lingua principale
Go
Stelle
952
Fork
82
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

### Platform

Other

### Protocol

DNS-over-HTTPS

### Do you use AdGuard app?

No I don't

### Your configuration

_No response_

### Traceroute to AdGuard DNS

_No response_

### Issue Details

I am trying to automate parental control services (YouTube, TikTok, Instagram, Facebook) for my home network via API.

Steps to reproduce:
1. Authenticate using a valid API Token.
2. Attempt a PUT request to: https://adguard-dns.io/api/v1/dns_servers/824a88da/settings/parental/web_services
3. Payload: {"blocked_services": ["youtube", "tiktok", "instagram", "facebook"]}

Result:
I receive a "401 Unauthorized" error.

Request details:
- Status code: 401
- Error message: {"error": "unauthorized"}
- The same endpoint works perfectly when accessed via the web dashboard (session-based authentication).

"Error. Url: https://adguard-dns.io/api/v1/dns_servers/824a88da/settings/parental/web_services?api_key=MY KEY. Status code 401. Payload: b'{\n "blocked_services": []\n}'"

Could you please clarify if this endpoint requires a different authentication method (such as an X-Api-Key) or if parental control settings are restricted for API tokens?

Thank you!

### Expected Behavior

I expect to be able to update parental control services using my valid API Token, similar to how other DNS server settings are managed.

### Actual Behavior

The API returns a '401 Unauthorized' response code with the message 'Invalid token' or 'unauthorized' when trying to perform a PUT request to the parental/web_services endpoint. This happens despite using a valid API Token that works for other API operations. Even when sending the exact payload {"id": "youtube", "enabled": true} via PUT, the API returns HTTP 401 with header: WWW-Authenticate: Bearer error="invalid_token", error_description="Invalid token"

Issue details: I am attempting to programmatically manage parental control services (blocking/unblocking specific apps like YouTube, TikTok, etc.) via the AdGuard DNS Cloud API for my smart home integration. While general DNS server management works with my API Token, the specific endpoint for parental control returns a 401 Unauthorized error.

Actual behavior: The API returns a '401 Unauthorized' response code with the message 'Invalid token' or 'unauthorized' when trying to perform a PUT request to the parental/web_services endpoint. This happens despite using a valid API Token that works for other API operations.

Authenticate using a valid API Token.

Attempt a PUT request to: [https://adguard-dns.io/api/v1/dns_servers/824a88da/settings/parental/web_services](https://adguard-dns.io/api/v1/dns_servers/824a88da/settings/parental/web_services)

Payload: {"blocked_services": ["youtube", "tiktok", "instagram", "facebook"]}

### Screenshots

Screenshot 1:

### Additional Information

_No response_

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.