问题
Hopefully a simple answer to what I think is a simple question.
Is it possible to Extract the BearerToken from the IAuthorizer once I am authenticated? After using LinqToTwitter to authorize, I want to make my own API calls and I need the BearerToken to do so.
Thank you for your time in advance!
回答1:
I'm assuming you're talking about ApplicationOnlyAuthorizer
. The demos assign to IAuthorizer
, so you need to convert to ApplicationOnlyAuthorizer
to expose the BearerToken
, like this:
await auth.AuthorizeAsync();
string bearerToken = (auth as ApplicationOnlyAuthorizer).BearerToken;
来源:https://stackoverflow.com/questions/45928634/extract-bearertoken-from-linqtotwitter-iauthorizer