VMh
VMh

Reputation: 1340

Consuming External Provider Tokens on Asp.net Core Identity

I have enabled login with Facebook, Google and Twitter in an Asp.Net core project. I am also saving the corresponding tokens to table AspNetUserTokens. How can I retrieve Twitter tokens, for example, to access Twitter API on behalf of a user; without having this user log into Twitter or even being logged in to my application at the moment I am using Twitter API?

Upvotes: 0

Views: 974

Answers (1)

VMh
VMh

Reputation: 1340

I was looking into the SignInManager but the right place to look for it was the UserManager:

 var accessToken = await _userManager.GetAuthenticationTokenAsync(user, "Twitter", "access_token");
 var accessTokenSecret = await _userManager.GetAuthenticationTokenAsync(user, "Twitter", "access_token_secret");

Upvotes: 2

Related Questions