द्वारा मैं अपने कंसोल perl स्क्रिप्ट में oAuth2 वेब रीडायरेक्ट ऑथ से रीफ्रेश टोकन का उपयोग करने का प्रयास कर रहा हूं। क्लाइंट आईडी एक ही और सही क्लाइंट आईडी है जो मैंने अपने जावास्क्रिप्ट में उपयोग की है, मैंने इसे 5 बार चेक किया है, यह मेरे Google एपीआई कंसोल में जैसा है।Google oAuth2 unauthorized_client refresh_token
ग्राहक रहस्य दो की जांच की जाती है और यह सही है।
ताज़ा टोकन approval_prompt=force&access_type=offline
यहाँ से बनाया गया था मेरी पर्ल नमूना कोड मैं का उपयोग किया जाता है:
# -----------------------------------------------------------------------------------
my $CLIENT_ID = 'XXXXX.apps.googleusercontent.com';
my $CLIENT_SECRET = 'YYYYYYYYYYY';
# -----------------------------------------------------------------------------------
# TESTING
my $refresh_token = '1/is_5_minutes_old';
# -----------------------------------------------------------------------------------
my $string = '';
$string .= 'grant_type=refresh_token';
$string .= '&client_id=' . $CLIENT_ID;
$string .= '&client_secret=' . $CLIENT_SECRET;
$string .= '&refresh_token=' . $refresh_token;
$ua = LWP::UserAgent->new;
my $req =
HTTP::Request->new(POST => 'https://accounts.google.com/o/oauth2/token');
$req->content_type('application/x-www-form-urlencoded');
$req->content($string);
print $string . "\n";
my $res = $ua->request($req);
print $res->as_string;
इसके बारे में प्रतिक्रिया:
HTTP/1.1 400 Bad Request
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Connection: close
Date: Mon, 02 Sep 2013 10:50:26 GMT
Pragma: no-cache
Server: GSE
Content-Type: application/json
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Alternate-Protocol: 443:quic
Client-Date: Mon, 02 Sep 2013 10:50:26 GMT
Client-Peer: 74.125.136.84:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/O=Google Inc/CN=Google Internet Authority G2
Client-SSL-Cert-Subject: /C=US/ST=California/L=Mountain View/O=Google Inc/CN=accounts.google.com
Client-SSL-Cipher: RC4-SHA
Client-SSL-Warning: Peer certificate not verified
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
{
"error" : "unauthorized_client"
}
मैं आशा है कि आप के लिए एक विचार है मदद।
Greatings