|
Jerome Rigal - 2014-09-10 14:13:22 - In reply to message 10 from Jerome Rigal
Hello,
Seeing this error, I checked the "client_id" and "app_secret" in my application.
Strangely, my app_secret was changed. It works now.
Sorry for the inconvenience.
Manuel Lemos - 2014-09-10 19:04:55 - In reply to message 10 from Jerome Rigal
The error message says you are not using the corrent client id or secret keys.
John Arterberry - 2014-10-13 06:16:33 - In reply to message 12 from Manuel Lemos
Hello Manuel, you built a great library. I also have the same code...as follows:
"Jawbone":
{
"oauth_version": "2.0",
"dialog_url": "https://jawbone.com/auth/oauth2/auth?&response_type=code&client_id={CLIENT_ID}&scope=move_read&redirect_uri={REDIRECT_URI}&state={STATE}&code={CODE}",
"access_token_url": "https://jawbone.com/auth/oauth2/token?client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}&redirect_uri={REDIRECT_URI}&code={CODE}&grant_type=authorization_code",
"authorization_header": true,
"token_request_method": "POST"
},
I included the authorization header because Jawbone requires it.
For some reason, my problem occurs with an authorization error. I provided my debug information below. This is killing me. Do you have an idea as to what would be the reason for this? In the debug - I intentionally cleared out my redirect_uri, client_id and client_secret
Thanks Manuel!
oauth_client_class Object
(
[error] =>
[debug] => 1
[debug_http] => 1
[exit] =>
[debug_output] => OAuth client: Checking if OAuth access token was already retrieved from https://jawbone.com/auth/oauth2/token?client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}&redirect_uri={REDIRECT_URI}&code={CODE}&grant_type=authorization_code
OAuth client: A valid access token is not available
OAuth client: Checking the authentication state in URI /oauth/jawbone.php?state=1412752737-e06faf&code=W3AjaI7_iOUTCzCWQJerYkLsustPIqURTe_avQUVzlDxz1CShLNFiMdKXBCNYlGP3S9lsTYELynpGgsuWgbWr--GVkL4W468gA0vox9BEJVeQaE-y_Ag1qIwg5Jnf2wau806cG3fyeIxfaPISsjB8yQDIeSAdiSDXCiE2Yb0anb2d2KM2PfxE43fUxJ5w70pe3nvcffbKdpi1yT2gHHtEw
OAuth client: Checking the authentication code
OAuth client: Accessing the OAuth access token at https://jawbone.com/auth/oauth2/token?client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}&redirect_uri={REDIRECT_URI}&code={CODE}&grant_type=authorization_code
[debug_prefix] => OAuth client:
[server] => Jawbone
[configuration_file] => oauth_configuration.json
[request_token_url] =>
[dialog_url] => https://jawbone.com/auth/oauth2/auth?&response_type=code&client_id={CLIENT_ID}&scope=move_read&redirect_uri={REDIRECT_URI}&state={STATE}&code={CODE}
[offline_dialog_url] =>
[append_state_to_redirect_uri] =>
[access_token_url] => https://jawbone.com/auth/oauth2/token?client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}&redirect_uri={REDIRECT_URI}&code={CODE}&grant_type=authorization_code
[oauth_version] => 2.0
[url_parameters] =>
[authorization_header] => 1
[token_request_method] => POST
[signature_method] => HMAC-SHA1
[redirect_uri] => XXXXXXXXX
[client_id] => XXXXXXXX
[client_secret] => XXXXXXXX
[api_key] =>
[get_token_with_api_key] =>
[scope] => move_read
[offline] =>
[access_token] =>
[access_token_secret] =>
[access_token_expiry] =>
[access_token_type] =>
[default_access_token_type] =>
[access_token_parameter] =>
[access_token_response] =>
[store_access_token_response] =>
[access_token_authentication] =>
[refresh_token] =>
[access_token_error] =>
[authorization_error] => it was not possible to retrieve the access token: it was returned the error: invalid_request
[response_status] => 200
[oauth_username] =>
[oauth_password] =>
[grant_type] => authorization_code
[oauth_user_agent] => PHP-OAuth-API (http://www.phpclasses.org/oauth-api $Revision: 1.114 $)
Manuel Lemos - 2014-10-13 07:49:45 - In reply to message 13 from John Arterberry
The access_token_url should not take any parameters in the URL.
Anyway I just added built-in support to Jawbone in the package. You may try the example script login_with_jawbone.php now.
John Arterberry - 2014-10-13 21:39:04 - In reply to message 14 from Manuel Lemos
Thank you so much Manuel! You do great work!!! Perfect work!!!
John Arterberry - 2014-10-16 18:25:23 - In reply to message 14 from Manuel Lemos
Hi Manuel,
When testing my code, I see an authorization error (below are my logs) and I check my Jawbone account
to ensure that I can log in - and there is no issue. I even checked this under the Jawbone console and I was able to get basic user information without error.
I'm researching more - I will also try this in another browser.
I appreciate your help!
CODE - no changes to the CallAPI function:
$success = $client->CallAPI(
'https://jawbone.com/nudge/api/v.1.1/users/@me',
'GET', array(), array(
'FailOnAccessError'=>true,
'FollowRedirection'=>true
), $user);
DEBUG MESSAGE:
oauth_client_class Object
(
[error] =>
[debug] => 1
[debug_http] => 1
[exit] =>
[debug_output] => OAuth client: Checking if OAuth access token was already retrieved from https://jawbone.com/auth/oauth2/token
OAuth client: The OAuth access token XXXXXXXXXX- is valid
OAuth client: The OAuth access token is of type Bearer
[debug_prefix] => OAuth client:
[server] => Jawbone
[configuration_file] => oauth_configuration.json
[request_token_url] =>
[dialog_url] => https://jawbone.com/auth/oauth2/auth?response_type=code&client_id={CLIENT_ID}&redirect_uri={REDIRECT_URI}&state={STATE}&scope={SCOPE}
[offline_dialog_url] =>
[append_state_to_redirect_uri] =>
[access_token_url] => https://jawbone.com/auth/oauth2/token
[oauth_version] => 2.0
[url_parameters] =>
[authorization_header] => 1
[token_request_method] => GET
[signature_method] => HMAC-SHA1
[redirect_uri] => XXXXXXXX
[client_id] => XXXXXXXXX
[client_secret] => XXXXXXXXX
[api_key] =>
[get_token_with_api_key] =>
[scope] =>
[offline] =>
[access_token] => XXXXXXXXX
[access_token_secret] =>
[access_token_expiry] => 2015-10-10 06:29:10
[access_token_type] => Bearer
[default_access_token_type] =>
[access_token_parameter] =>
[access_token_response] =>
[store_access_token_response] =>
[access_token_authentication] =>
[refresh_token] => XXXXXXXXX
[access_token_error] =>
[authorization_error] =>
[response_status] => 0
[oauth_username] =>
[oauth_password] =>
[grant_type] => authorization_code
[oauth_user_agent] => PHP-OAuth-API (http://www.phpclasses.org/oauth-api $Revision: 1.118 $)
)
Error: it was not possible to access the API call: it was returned an unexpected response status 401 Response: {"meta": {"code": 401, "error_detail": "You must be logged in to perform that action", "error_type": "authentication_error", "message": "Unauthorized"}, "data": {}}
Manuel Lemos - 2014-10-17 07:33:25 - In reply to message 16 from John Arterberry
I do not see any problem there. I tried the same API call here and it worked well for my token.
Could it be because your token became invalid for some reason and you need to restart the process?
Try calling ResetAccessToken and restart the process with a new token.
volkan66 - 2014-10-29 00:48:50 - In reply to message 11 from Jerome Rigal
Hi Jerome Rigal,
can you send me the PHP code, please?
|