Closed webloper closed 3 years ago
It seems that your Authorization Bearer token is no more valid. Please try once again by passing valid once and confirm as its working for me.
Thanks & Regards, Logicmaker
@big89 Hi I have checked thrice, every time i am getting the same error
Hey @webloper Try , curl -X GET "https://cdndemo-api.co-vin.in/api/v2/appointment/centers/findByLatLong?lat=26.846695&long=80.946167" -H "accept: application/json" -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxx"
hi I have checked same from localhost and server
curl -X GET "https://cdndemo-api.co-vin.in/api/v2/appointment/centers/findByLatLong?lat=26.846695&long=80.946167" -H "accept: application/json" -H "Authorization: Bearer eyJhXXXXXXXXXXXX"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Generated by cloudfront (CloudFront) Request ID: OLns21Lag2ACEBPqjdBgo2d_kMKHlI026yXApf5TWOqah2FYAXeNzA==
@webloper ,Are you requesting this API within India or outside India..? Because it is working fine with testing ..
@webloper You should access this APIs from Indian IP only.
Check the below working PHP cURL script for the same -
`<?php // Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/ $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://cdndemo-api.co-vin.in/api/v2/appointment/centers/findByLatLong?lat=28.7&long=77.1'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
$headers = array(); $headers[] = 'Accept: application/json'; $headers[] = 'Accept-Language: en_US'; $headers[] = 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch);
echo $result;
?>`
Thanks, Logicmaker
:cry:
@big89
@badinenisaivardhan India Lucknow :cry:
@webloper It will be better if you could explain in detail the steps you are following.
@big89
Here are the steps
BASE_URL = https://cdndemo-api.co-vin.in/api/v2
Step 1 POST {{BASE_URL}}/auth/public/generateOTP Request Param mobile Response txnId
Step 2 POST {{BASE_URL}}/auth/public/confirmOTP Request Param sha256 ( otp ), txnId Response token = xxxxxxxxxxxxxxx
Step 3 GET {{BASE_URL}}/appointment/beneficiaries Request Headers Accept: application/json Accept-Language: en_US Authorization: Bearer token
Response Unauthenticated access!
hey @webloper , on identifying steps you have followed, you are using wrong end points for sandbox ,use this endpoints for sandbox testing,not public endpoints.. OTP Generation : https://cdndemo-api.co-vin.in/api/v2/auth/generateOTP Token Generation And OTP Conformation : https://cdndemo-api.co-vin.in/api/v2/auth/confirmOTP and above code in php will work ... Thanks..!
@badinenisaivardhan :no_mouth: Thanks its working, I didn't notice this change damn.
Closing this issue
curl -X GET "https://cdndemo-api.co-vin.in/api/v2/appointment/centers/findByLatLong?lat=26.846695&long=80.946167" -H "accept: application/json" -H "Accept-Language: hi_IN" -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxx"
Getting response - 401
Unauthenticated access!