cowinapi / developer.cowin

This group is created to facilitate technical and integration discussions related to cowin platform. API related contents can be obtained at API setu portal https://apisetu.gov.in/public/marketplace/api/cowin
115 stars 30 forks source link

findByLatLong - Unauthenticated access! #457

Closed webloper closed 3 years ago

webloper commented 3 years ago

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!

big89 commented 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

webloper commented 3 years ago

@big89 Hi I have checked thrice, every time i am getting the same error

badinenisaivardhan commented 3 years ago

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"

webloper commented 3 years ago

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">

ERROR: The request could not be satisfied

403 ERROR

The request could not be satisfied.


Request blocked. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.

Generated by cloudfront (CloudFront)
Request ID: OLns21Lag2ACEBPqjdBgo2d_kMKHlI026yXApf5TWOqah2FYAXeNzA==
badinenisaivardhan commented 3 years ago

@webloper ,Are you requesting this API within India or outside India..? Because it is working fine with testing .. Capture

big89 commented 3 years ago

@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

webloper commented 3 years ago

:cry:

@big89 Clipboard01

webloper commented 3 years ago

@badinenisaivardhan India Lucknow :cry:

big89 commented 3 years ago

@webloper It will be better if you could explain in detail the steps you are following.

webloper commented 3 years ago

@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!

badinenisaivardhan commented 3 years ago

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..!

webloper commented 3 years ago

@badinenisaivardhan :no_mouth: Thanks its working, I didn't notice this change damn.

webloper commented 3 years ago

Closing this issue