Extract BearerToken from LinqToTwitter IAuthorizer

2019-02-27 06:09发布

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条回答
放荡不羁爱自由
2楼-- · 2019-02-27 06:40

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;
查看更多
登录 后发表回答