User
- The FreshBooks account, whose information we are trying to access via OAuthConsumer
- The FreshBooks account, who we authorize to access the user's informationConsumer key
- The consumer's subdomain,consumer_key.freshbooks.com
Consumer Secret
- The consumer's secret, that we will use to make OAuth requests.Request Token
- A value used by the consumer to obtain authorization and an access token from the user.Access Token
- A value used by the consumer to access the user's information.Access Token Secret
- A secret used by the consumer to establish ownership of a given Token.
This file contains hidden or 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
import org.apache.commons.logging.LogFactory; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.entity.mime.*; | |
import org.apache.http.entity.mime.content.*; | |
import org.apache.http.impl.client.DefaultHttpClient; | |
import org.apache.http.Header; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.util.EntityUtils; | |
import org.apache.http.entity.StringEntity; | |
import javax.net.ssl.*; |
This file contains hidden or 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
exports.create = function(req, res) { | |
Subscriptions | |
.saveToDatabase(req.body) | |
.then(function(subscription) { | |
return subscription.verify(); | |
}).then(function(body) { | |
returnVerifyResponse(body, res); | |
}).fail(function(body) { |
I'm writing an app that talks to Apple to verifyReceipts. They have both a sandbox and production url that you can post to.
When communicating with Apple, if you receive a 21007
status, it means you were posting to the production url, when you should be posting to the sandbox one.
So I wrote some code to facilitate the retry logic. Here's a simplified version of my code:
var request = require('request')
, Q = require('q')
;
NewerOlder