Skip to content

Instantly share code, notes, and snippets.

@nutti
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nutti/53a488b19c2ee8e427e8 to your computer and use it in GitHub Desktop.
Save nutti/53a488b19c2ee8e427e8 to your computer and use it in GitHub Desktop.
[PhoneGap] Get OAuth's access token in Qiita
var params = {
'client_id': clientID, // 登録したアプリのクライアントID
'client_secret': clientSecret, // 登録したアプリのクライアントシークレット
'code': code // リダイレクトURLのクエリのcodeの値
};
$.ajax({
url: getAPIURL('https://qiita.com/api/v2/access_tokens'),
type: 'POST',
headers: {
'Content-Type': 'application/json',
},
dataType: 'json',
data: JSON.stringify(params),
success: function(res) {
alert('ok');
},
error: function(e) {
alert(e.status + ":" + e.statusText);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment