Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oauth headers with post() #295

Open
Budsy opened this issue Dec 25, 2021 · 1 comment
Open

Oauth headers with post() #295

Budsy opened this issue Dec 25, 2021 · 1 comment

Comments

@Budsy
Copy link

Budsy commented Dec 25, 2021

It seems that using addHeader on a post call is not working for me. Can anyone see why?

This fails to execute, (white screen, even when wrapped in try/catch block.):

`

$response = \Httpful\Request::post($url . '?' . $data . '&is_quicksend=true')
->addHeader('Authorization', 'Zoho-oauthtoken ' . $access_token)
->expectsJson()
->sendsJson()
->send();
`

But the following with addHeader stubbed out succeeds in running the post, but of course will not authenticate with Zoho Sign:

`

       $response = \Httpful\Request::post($url . '?' . $data . '&is_quicksend=true') 
                             
	 // ->addHeader('Authorization', 'Zoho-oauthtoken ' .  $access_token) 
	 		 		 
	  ->expectsJson()
	   		   		  
	  ->sendsJson()
	   		   		  
	  ->send();`

The response payload coming back from Zoho Sign API in the latter case is:

{"code":9031,"message":"Ticket invalid","status":"failure"}

The token and header formation are valid when sent through Curl on a command line, so it's not the token or the header formation.

@chrisfield490
Copy link

Have you tried removing 'Zoho-oauthtoken' and just leaving the $access_token?

This is a java example, so it may be this.

Java

Using Apache HTTPClient.

DefaultHttpClient httpclient = new DefaultHttpClient();

String url = "http://localhost";

HttpPost httpPost = new HttpPost(url);

httpPost.addHeader("Authorization" , "");

HttpResponse response = httpclient.execute(httpPost);

I hope its of some help, although i have never tried the api with zoho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants