Skip to content
This repository has been archived by the owner on Mar 26, 2021. It is now read-only.

Неожиданный 401 UNAUTHORIZED #28

Open
ed-asriyan opened this issue Nov 17, 2018 · 4 comments
Open

Неожиданный 401 UNAUTHORIZED #28

ed-asriyan opened this issue Nov 17, 2018 · 4 comments
Labels
bug Something isn't working

Comments

@ed-asriyan
Copy link
Member

баг не затрагивает рабочую область, но всё равно это странное поведение:

если в заголовке GET запроса передать Content-Type: application/json, то будет возвращен 401 UNAUTHORIZED вне зависимости от того, валидный токен или нет.

было проверено на /user/user_info и /v2/user/relations

@ed-asriyan ed-asriyan added the bug Something isn't working label Nov 17, 2018
@wolf1996
Copy link
Contributor

не воспроизвелось.

@ed-asriyan
Copy link
Member Author

С заголовком

curl -i -H "Content-Type: application/json" -X GET "http://142.93.108.222:5000/user/user_info?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxfQ.vw234NQm1ZDkiuE2eANloMC9Gwbw2Gr-V9ybi87X8BU"
HTTP/1.0 401 UNAUTHORIZED
Content-Type: application/json
Content-Length: 46
Server: Werkzeug/0.14.1 Python/3.5.3
Date: Mon, 26 Nov 2018 09:34:21 GMT

{"msg": {"msg": "Not Authorized"}, "code": 2}

Без заголовка

curl -i -X GET "http://142.93.108.222:5000/user/user_info?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxfQ.vw234NQm1ZDkiuE2eANloMC9Gwbw2Gr-V9ybi87X8BU"
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 548
Server: Werkzeug/0.14.1 Python/3.5.3
Date: Mon, 26 Nov 2018 09:35:59 GMT

{"msg": {"division_number": "123", "name": "\u0418\u0432\u0430\u043d", "mobile_phone": "8-800-555-35-35", "second_name": "\u0418\u0432\u0430\u043d\u043e\u0432\u0438\u0447", "family_name": "\u0418\u0432\u0430\u043d\u043e\u0432", "mailing_addres": "\u0423\u043b\u0438\u0446\u0430\u0423\u043b\u0438\u0446\u0430", "sex": true, "birth_day": "123341", "date_receiving": 123, "home_phone": "8-800-555-35-35", "issued_by": "123", "e_mail": "[email protected]", "registration_addres": "\u0423\u043b\u0438\u0446\u0430", "citizenship": "\u0420\u0424"}, "code": 0}

@ed-asriyan ed-asriyan reopened this Nov 26, 2018
@ed-asriyan
Copy link
Member Author

ed-asriyan commented Mar 3, 2019

аналогично для DELETE

всё ок:

curl -X DELETE 'https://api.meter4.me/v2/controller/2/activate?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxfQ.67xd4JeTDQDOyJ3jLUxsAC937QKe9UoaEC4pYKeTaus'

401:

curl -H "Content-Type: application/json" -X DELETE 'https://api.meter4.me/v2/controller/2/activate?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxfQ.67xd4JeTDQDOyJ3jLUxsAC937QKe9UoaEC4pYKeTaus'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants