I am working on Yii2
. I have a URL
which on hitting a browser is redirected to my redirect URI
.
URL
https://accounts.zoho.com/oauth/v2/auth?scope=ZohoBugTracker.projects.ALL,ZohoBugTracker.bugs.ALL&client_id=1000&response_type=code&access_type=offline&redirect_uri=http://11.111.111.111:7000/api/oauth/zoho_auth
When I hit the above URL it will redirect to my redirect URI while giving a code
Redirect URI
After hitting the above URL the redirect URI is http://11.111.111.111:7000/api/oauth/zoho_auth?code=1000&location=us&accounts-server=https%3A%2F%2Faccounts.zoho.com
Redirect URI Response
{"Message":"No HTTP resource was found that matches the request URI 'http://11.111.111.111:7000/api/oauth/zoho_auth?code=1000&location=us&accounts-server=https:%2F%2Faccounts.zoho.com'."}
How to get the code
from the above response?
Update 1
As per suggestion given. I tried to send a GET
request using linslin. Below is my code
public static function authToken()
{
$curl = new curl\Curl();
$response = $curl->setGetParams([
'scope' => 'ZohoBugTracker.projects.ALL,ZohoBugTracker.bugs.ALL',
'client_id' => '1000',
'response_type' => 'code',
'access_type' => 'offline',
'redirect_uri' => 'http://11.111.111.111:7000/api/oauth/zoho_auth',
])
->get('https://accounts.zoho.com/oauth/v2/auth');
echo $response;
exit();
}
And then called this function inside a function through which I am actually creating bugs using zoho API
Testing my API
via POSTMAN
http://localhost:225/inventory-web/api/web/v1/installation/email?ref_no=28373340485858U&customer_id=37030315933&site_snap_name=28373340485858U_1530958224_site_9.jpg&flag=1
My email
function is written inside a API controller. So, it will first hit the issueSetup($param1,$param2)
public function actionEmail()
{
.
.
.
.
Installations::setupEmail($param1, $param2, $param3);
.
.
.
}
The above function setupEmail($param1,$param2,$param3)
is inside my controller.
public static function setupEmail($ref_no, $customer_id, $install_id)
{
.
.
.
.
.
list(params.....)= Installations::issueSetup($param1,$param2);
.
.
.
.
}
issuSetup funciton
public static function issueSetup($param1,$param2)
{
.
.
.
.
$token = Installations::authToken();
exit();
.
.
.
.
}
After hitting the API
the I am getting no response in POSTMAN just the empty window
Any help would be highly appreciated.
Its working quite fine when you enable SSL and check the response code / response header to redirect to the userAuth form on Zuhu:
$curl = new \linslin\yii2\curl\Curl();
/** @var Curl $response */
$curl->setGetParams([
'scope' => 'ZohoBugTracker.projects.ALL,ZohoBugTracker.bugs.ALL',
'client_id' => '1000',
'response_type' => 'code',
'access_type' => 'offline',
'redirect_uri' => 'http://11.111.111.111:7000/api/oauth/zoho_auth',
])->setOption(CURLOPT_SSL_VERIFYPEER, true)
->setOption(CURLOPT_SSL_VERIFYHOST, false)
->setOption(CURLOPT_CAINFO, 'C:/Ampps/apache/conf/ssl_crt/cacert.pem')
->get('https://accounts.zoho.com/oauth/v2/auth');
$responseHeaders = $curl->responseHeaders;
if ($curl->responseCode === 302 && isset($responseHeaders['Location'])) {
header("location: ".$responseHeaders['Location']);
die();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With