PHP Google Contact API generateing HTTP/1.0 401 Authorization required

Asked
Active3 hr before
Viewed126 times

3 Answers

contactgoogle
90%

Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers , Stack Overflow Public questions & answers ,Thanks for contributing an answer to Stack Overflow!,I am using Google Contact API V3 with OAuth 2.0 to retrieve the contacts from Google Account, I am getting a OAuth Token from a child window using jQuery, and after post that token to another file which should get the User's Contacts, but when I pass the token to get the contacts from Google, but it gives an error "Warning: file_get_contents(https://www.google.com/m8/feeds/contacts/default/full&oauth_token=[token]) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.0 401 Authorization required in ...\getContacts.php on line 7"

Make sure that in your php.ini you have this lines:

extension = php_openssl.dll
allow_url_fopen = On
88%

Since the 401 Unauthorized Error is a client error response code, it’s best to start by troubleshooting any potential client-side issues that could be causing this error. Here are a handful of tips to try on the browser or device that is giving you problems.,The client is banned for some reason. Some applications use 401 Unauthorized Errors to restrict access requests from specific IP addresses, so if authentication is not the issue, a server-side ban could be the problem.,The client sent its authentication credentials to the server, but the server has rejected the credentials for some reason.,As with cookies, clearing the cache is browser-dependant, so here are a few links to that relevant documentation for the most popular browsers:

load more v
72%

I'm using my email address as the username in Basic Auth, and using the API token as the password. Postman is correctly generating a base64 encoded Authorization header with the value 'Basic <base64 encoded string>'.,I also faced the same issue, instead of putting your password, please create API token and put into the password. That works for me.,How to use Token in Java Rest client. I am using it simply passing as username/password for atlassian account. Should I pass it as a request parameter.,This was the same for me. I have a SSO with company managed account using a new email and always got 401 with my API token.

I'm hitting this problem too, while trying to use the Cloud REST API:

<html>

<head>
   <title>Unauthorized (401)</title>...trimmed... <div class="aui-message aui-message-warning warning">
      <p>Encountered a <code>&quot;401 - Unauthorized&quot;</code> error while loading this page. </p>
      <p> <a href="/secure/MyJiraHome.jspa">Go to Jira home</a> </p>
   </div>
   </section> <!-- .aui-page-panel-content -->
   </div> <!-- .aui-page-panel-inner -->
   </div> <!-- .aui-page-panel -->
   </body>

</html>

Other "contact-google" queries related to "PHP Google Contact API generateing HTTP/1.0 401 Authorization required"