Closed Charly3X closed 6 years ago
Значение, которое вы тут пытаетесь передать - это не refresh_token, а authorization_code (т.н. грант) Его сначала нужно обменять на refres_token
refresh_token=>"NmM3OWZ****************"
Пример как обменять, например так
POST /oauth/tokens/ HTTP/1.1
Host: demo.ehealth.world
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: a7590ce9-d9a7-6086-8b3b-972c34eacea4
{
"token":{
"grant_type":"authorization_code",
"code": "{{ authorization_code }}",
"client_id":"{{ client_id }}",
"client_secret": "{{ client_secret }}",
"redirect_uri": "{{ redirect_uri }}",
"scope":"{{ scopes }}"
}
}
А что за рефреш токен я получаю в ургенте когда я получаю первый токен свой?
Не понятен вопрос - покажите лог
Регистрирую медзаклад. Вхожу как керивник. Получаю ТОКЕН + РЕФРЕШ ТОКЕН. Токен валидный 1 месяц. Проходит месяц. Как обновить токен? В АПИ написано Currently access_token and refresh_token are configured to have same lifetime, so we don't expect you to refresh it.In future, you will be able to refresh access tokens to extend access_token lifetime.
Сейчас что получается обновление токена не работает?
ЛОГ
D, [2017-12-28T20:47:12.552790 #70594] DEBUG -- : [httplog] Connecting: api.ehealth.world:443 D, [2017-12-28T20:47:12.775785 #70594] DEBUG -- : [httplog] Sending: POST http://api.ehealth.world:443/api/oauth/tokens D, [2017-12-28T20:47:12.776045 #70594] DEBUG -- : [httplog] Header: content-type: application/json D, [2017-12-28T20:47:12.781297 #70594] DEBUG -- : [httplog] Header: authorization: Bearer b960d5667cda2ccb5aca19ba98a5a46c D, [2017-12-28T20:47:12.781404 #70594] DEBUG -- : [httplog] Header: api-key: 9cea483e5eb8af18a598 D, [2017-12-28T20:47:12.781433 #70594] DEBUG -- : [httplog] Header: accept-encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3 D, [2017-12-28T20:47:12.781458 #70594] DEBUG -- : [httplog] Header: accept: / D, [2017-12-28T20:47:12.781479 #70594] DEBUG -- : [httplog] Header: user-agent: Ruby D, [2017-12-28T20:47:12.781499 #70594] DEBUG -- : [httplog] Header: connection: close D, [2017-12-28T20:47:12.781563 #70594] DEBUG -- : [httplog] Data: {"token":{"client_id":"aa15a1f0-54a0-45b7-a777-5f7fb7d368d5","refresh_token":"UHF0Vm52RU1RbGtZay80S0hqOTJIdz09","client_secret":"RzFoUFRWT1NBSm5nSVJUTnZGL3luUT09","grant_type":"refresh_token"}} D, [2017-12-28T20:47:12.919601 #70594] DEBUG -- : [httplog] Status: 404 D, [2017-12-28T20:47:12.920147 #70594] DEBUG -- : [httplog] Header: connection: close D, [2017-12-28T20:47:12.920396 #70594] DEBUG -- : [httplog] Header: server: Cowboy D, [2017-12-28T20:47:12.920510 #70594] DEBUG -- : [httplog] Header: date: Thu, 28 Dec 2017 18:47:12 GMT D, [2017-12-28T20:47:12.920605 #70594] DEBUG -- : [httplog] Header: content-length: 169 D, [2017-12-28T20:47:12.920666 #70594] DEBUG -- : [httplog] Header: cache-control: max-age=0, private, must-revalidate D, [2017-12-28T20:47:12.920721 #70594] DEBUG -- : [httplog] Header: x-request-id: n8ldsvb23nlp36truguerc0g4pq0n78o D, [2017-12-28T20:47:12.920775 #70594] DEBUG -- : [httplog] Header: strict-transport-security: max-age=31536000 D, [2017-12-28T20:47:12.920826 #70594] DEBUG -- : [httplog] Header: content-type: application/json; charset=utf-8 D, [2017-12-28T20:47:12.921098 #70594] DEBUG -- : [httplog] Response: {"meta":{"url":"https://api.ehealth.world:443/api/oauth/tokens","type":"object","request_id":"n8ldsvb23nlp36truguerc0g4pq0n78o","code":404},"error":{"type":"not_found"}}
Anybody here? :)
Сейчас обновление токена работает с помощью этого метода: https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/oauth/use-refresh-token-for-access-token-extension
Также, можно получить токен повторно авторизовавшись
почему при ПОСТе на "https://api.ehealth.world/api/oauth/tokens" говорит 404 NotFound
"{"meta"=>{"url"=>"https://api.ehealth.world:443/api/oauth/tokens", "type"=>"object", "request_id"=>"8olfnde6ofqo01fb25u5bojtmiqc3iko", "code"=>404}, "error"=>{"type"=>"not_found"}}"
БОДИ "{:token=>{:client_id=>"aa15a1f0-54a0-45b7-a777-5f7fb7d368d5", :client_secret=>"RzFoUFRW*****", :refresh_token=>"NmM3OWZ****", :grant_type=>"refresh_token"}}"