Login   Register  
PHP Classes
elePHPant
Icontem

Problem with Microsoft and Yahoo authentication

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP OAuth API  >  All threads  >  Problem with Microsoft and Yahoo authentication  >  (Un) Subscribe thread alerts  
Subject:Problem with Microsoft and Yahoo authentication
Summary:I have some questions about the parameters for CallApi method
Messages:26
Author:Fernando Nascimento
Date:2012-09-25 21:40:21
Update:2013-06-21 04:30:52
 
  1 - 10   11 - 20   21 - 26  

  1. Problem with Microsoft and Yahoo authentication   Reply  
Picture of Fernando Nascimento
Fernando Nascimento
2012-09-25 21:40:21
Hi Manuel,

First of all, congratulations for your work in this class. It's great! I already worked with others versions and they're all so complicated with lots of files and nonsense stuff. This one integrating all main OAuth options is awsome!
I'm having some problems with Microsoft and Yahoo authentication and I'm pretty sure that I'm passing wrong parameters for the method CallAPI. Here's my question: what's the URL and method to microsoft and yahoo? And also, what's the format of the "scope" for them?
I looked online and in your class documentation but I couldn't find them. :\

For Microsoft OAuth, I'm using this for now:

-scope: "wl.basic";
-url: "https://login.live.com/oauth20_token.srf";
-method: POST

In this case, the authentication works, but I get this as user result:

Array
(
[
"Content-Type" Content="text/html; charset=us-ascii">
Length Required
HTTP Error 411. The request must be chunked or have a content length.
)

Thanks for your time.

  2. Re: Problem with Microsoft and Yahoo authentication   Reply  
Picture of Manuel Lemos
Manuel Lemos
2012-09-25 23:43:51 - In reply to message 1 from Fernando Nascimento
For Microsoft and Yahoo, you do not have to configure the URL parameters. Just set the server variable to 'Microsoft' or 'Yahoo' and the class auto-configures the URLs for the OAuth protocol.

The scope for permissions, you need to check their documentation to see what you need. For Microsoft usually 'wl.basic wl.emails' will be enough to get basic user information including the e-mail.

For Yahoo, they only support OAuth 1.0, so I suppose permissions are defined in the application configuration.

  3. Re: Problem with Microsoft and Yahoo authentication   Reply  
Picture of Matt Carpenter
Matt Carpenter
2012-10-02 14:17:34 - In reply to message 2 from Manuel Lemos
This is a really fantastic class. Thank you for all your work putting it together.

I, too, am having issues trying to use the Yahoo API. The initial authentication works fine, but then the API call fails with this error:
Error: it was not possible to retrieve the API call: authentication error: it was not requested any of the authentication mechanisms that are supported

This is code I am using to pull Yahoo contact data:

if( ($success = $client->Initialize()) ) {
$success = $client->Process();
if( $success ) {
$success = $client->CallAPI( 'http://social.yahooapis.com/v1/user/me/contacts?format=json&count=5', 'GET', array(), array(), $contacts );
}

$success = $client->Finalize($success);
}

  4. Re: Problem with Microsoft and Yahoo authentication   Reply  
Picture of Arno Buizer
Arno Buizer
2012-10-02 20:33:41 - In reply to message 3 from Matt Carpenter
I had those problems too and found out that format=json seems not to be supported by Yahoo (correctly)...
But the xml respons is not processed as I expect from the class. I only got the values, but not the keys or labels as I do get when using this class with Facebook,Google and Twitter!
I would be nice to have a working Yahoo example, especcially for setting the correct scope/permissions...
Maybe this reply helps you to work arround the strange behaviour with the json data request (mentioned in Yahoos'doc, but not working, even in their api TEST page!).

  5. Re: Problem with Microsoft and Yahoo authentication   Reply  
Picture of Manuel Lemos
Manuel Lemos
2012-10-03 12:21:13 - In reply to message 3 from Matt Carpenter
Did you check the access_token_error variable?

The API call may succeed in the sense there was not HTTP error, but the API may have returned a failure for some reason. The access_token_error variable returns the error including the response in most cases. Check that variable to see what is the error.

  6. Re: Problem with Microsoft and Yahoo authentication   Reply  
Picture of Matt Carpenter
Matt Carpenter
2012-10-03 14:32:50 - In reply to message 5 from Manuel Lemos
Thank you very much for the quick responses.

I tried switching to 'format=xml' and got the same error.
I also printed the access_token_error at various stages in the code and it was always empty

Here is the state of the $client variable right before I call the CallAPI function, minus the tokens and secrets:

oauth_client_class Object
(
[error] =>
[debug] => 1
[debug_http] =>
[exit] =>
[debug_output] => OAuth client: Checking the OAuth token authorization state
OAuth client: The OAuth token was already authorized

[debug_prefix] => OAuth client:
[server] => Yahoo
[request_token_url] => https://api.login.yahoo.com/oauth/v2/get_request_token
[dialog_url] => https://api.login.yahoo.com/oauth/v2/request_auth
[append_state_to_redirect_uri] =>
[access_token_url] => https://api.login.yahoo.com/oauth/v2/get_token
[oauth_version] => 1.0a
[redirect_uri] => https://67.21.3.77//testoath.php
[client_id] => DELETED
[client_secret] => DELETED
[scope] =>
[access_token] => DELETED
[access_token_secret] => DELETED
[access_token_expiry] =>
[access_token_type] =>
[access_token_error] =>
[authorization_error] =>
[authorization_header] => 1
[oauth_user_agent] => PHP-OAuth-API (http://www.phpclasses.org/oauth-api $Revision: 1.30 $)
)

  7. Re: Problem with Microsoft and Yahoo authentication   Reply  
Picture of Manuel Lemos
Manuel Lemos
2012-10-03 21:13:33 - In reply to message 6 from Matt Carpenter
This is odd because if it returns the error you mention above, the error variable should be set to that error but in your output it seems to be empty. Have you changed anything between the call above and this last one?

  8. Re: Problem with Microsoft and Yahoo authentication   Reply  
Picture of Matt Carpenter
Matt Carpenter
2012-10-04 13:19:38 - In reply to message 7 from Manuel Lemos
The error is coming from the sasl.php file, although I haven't had a chance to trace it all the way through to figure out why. Just did a grep to find that error string. Nothing has changed with the function call that I posted. I did try setting format=xml, but that returned the same error.

Thanks again for your help.

  9. Re: Problem with Microsoft and Yahoo authentication   Reply  
Picture of Manuel Lemos
Manuel Lemos
2012-10-05 04:46:54 - In reply to message 8 from Matt Carpenter
No, the SASL library is not meant to be used. That is meant for regular authentication types. The OAuth class explicitly disables the SASL library use for authentication. Did you by any chance change the OAuth class to enabled the use of SASL library?

  10. Re: Problem with Microsoft and Yahoo authentication   Reply  
Picture of Arno Buizer
Arno Buizer
2012-10-05 08:30:01 - In reply to message 9 from Manuel Lemos
maybe this errormesage (which I get via the return $userinfo) is related to this? (when trying to use the Yahoo interface)

"it was not possible to retrieve the OAuth request token: the SASL client class needs to be loaded to be able to authenticate and access this site"

I work with your latest oauth client and php versions, without modifications. (this already occured with the previous oauth client version)
I do not have further (debugging) details because of lack of time to spend on it... But I hope my observations help you guys to pin point possible problems in this library and/or the way we are using it now...

By the way, this lib already helped me to get this oauth functionality working in a relative short time! (I integrated the examples for Facebook and Google and Twitter in one piece of code, and all three work succesfull in a site I maintain for members of my church).

So thank you very much for creating this PHP OAuth API package!!!

 
  1 - 10   11 - 20   21 - 26