Last active
August 29, 2015 14:16
-
-
Save nutti/53a488b19c2ee8e427e8 to your computer and use it in GitHub Desktop.
[PhoneGap] Get OAuth's access token in Qiita
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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