AdguardTeam / AdguardTeam/AdGuardDNS

API Issue: 401 Unauthorized when accessing parental/web_services endpoint

オープン
#1,041 コメント 5 件 リアクション 0 件 担当者 1 名 @Chinaski1 が担当を希望しています GitHub で見る
feature request
主要言語
Go
スター
952
フォーク
82
PR マージ指標
30日以内にマージされた PR はありません

説明

### 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_

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。