Question

I'm not sure if this is even possible, but the oAuth playground at:

https://appcenter.intuit.com/Playground/OAuth/IA/?ck=consumer_key&cs=consumer_secret

seems to suggest that it is. Along with consumer key/secret field, there's an access token expiry field. The subsequent URL that's used is:

https://appcenter.intuit.com/Connect/SessionStart?grantUrl=https%3A%2F%2Fappcenter.intuit.com%2FPlayground%2FOAuth%2FBeginIAFlow%3Fconsumer_key%3D[my_consumer_key]%26consumer_secret%3D[my_consumer_secret]%26access_token_lifetime%3D300

The access_token_lifetime parameter at the end is specifying the access token lifetime in seconds, but I've tried inserting this parameter into my URL that's sent to both the request token API and the access token API (not both at the same time, just one or the other separately). For example, for the request token API, I've tried:

HttpParameters additionalParams = new HttpParameters();
additionalParams.put("oauth_callback", URLEncoder.encode(callback_url, "UTF-8"));
additionalParams.put("access_token_lifetime", "500");
ouathconsumer.setAdditionalParameters(additionalParams);

String signedRequestTokenUrl = ouathconsumer.sign(REQUEST_TOKEN_URL);
signedRequestTokenUrl += "&access_token_lifetime=500";

...and for the access token API:

HttpParameters additionalParams = new HttpParameters();
additionalParams.put("oauth_callback", "oob");
additionalParams.put("oauth_verifier", verifierCode);
additionalParams.put("access_token_lifetime", "500");
consumer.setAdditionalParameters(additionalParams);

String signedURL = consumer.sign(ACCESS_TOKEN_URL);
signedURL += "&access_token_lifetime=500";

Neither has worked. The oAuth process succeeds in both cases, and my developer account shows that a new connection has been establised. But that connection is still valid even after 500 seconds.

However, there's no mention of setting access token expiration time in the Intuit docs for the standard oAuth token expiration (180 days), so I hope that doesn't mean it's not possible:

https://developer.intuit.com/docs/0025_quickbooksapi/0010_getting_started/0020_connect/0010_from_within_your_app/implement_oauth_in_your_app/token_renewal_and_expiration

Was it helpful?

Solution

It isn't possible to set your own token lifetime.

Why would anyone even need this?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top