The Twitter OAuth 1.0a flow requires authenticated request token
to be exchanged with access token
at consumer or client
side after user
has authenticated.
The problem that I'm facing is that generating access token
needs authenticated request token
, request token secret
and verifier
but the response from the oauth/authentication
api doesn't have request token secret
. So how do I temporarily save request token secret from oauth/request_token
api call so that I can use it in oauth/access_token
api call.
I found some solutions from my explorations like Running a Cache server (Memcached, Redis) or using django session feature. But they all seem to be overkill for this task.
I hope to find a simpler solution.
I'm sure you long ago figured this out, but just for future goolers: I decided to a go a more low tech route and create an OAuth token class which includes fields for the fetched and access token. Basically I take the fetched token, store it, then recall it when accessing (as it's in a different view) and then save the access token. Once (if) that's successful than I delete the fetched token.
There's likely a more glamorous way to do this, but if you're clever with your naming convention you can easily keep them straight (i.e. add a CharField for provider and just save the fetched token as twitter_fetched, and the access token as just twitter).
This has the added benefit of allowing you to create an OAuth1 or OAuth1Session from the stored access token.