c# - Using Linq2Twitter and cached OAuth tokens withing a ServiceStack api -
i want use linq2twitter make twitter api call within rest api written in servicestack.
i have following information:
- consumerkey
- consumersecret
- cached oauth token when user authenticated our app on site
- cached oauth tokensecret when user authenticated our app on site
how create twittercontext using information can make api calls? looking @ documentation , see webform, mvc, desktop examples, none current use case. don't think can use webform/mvc ones try redirect user authorization page if token/token secret bad. looked @ desktop example , uses pin authorization, don't think can use either.
i understand token/token secret may bad if user decides revoke access after have cached these values, need way verify , nothing if fails.
this question isn't same, authorizer concept might interesting you:
how use linq twitter inside web service?
essentially, want instantiate authorizer, assigning values credentials property, this:
var auth = new singleuserauthorizer { credentials = new singleuserinmemorycredentials { consumerkey = configurationmanager.appsettings["twitterconsumerkey"], consumersecret = configurationmanager.appsettings["twitterconsumersecret"], twitteraccesstoken = configurationmanager.appsettings["twitteraccesstoken"], twitteraccesstokensecret = configurationmanager.appsettings["twitteraccesstokensecret"] } };
then, instantiate twittercontext, this:
var ctx = new twittercontext(auth);
the particular authorizer, in case, singleuserauthorizer can use same authorizer used original credentials. provide 4 credentials , linq twitter bypass user re-direct authorization on twitter.
Comments
Post a Comment