title: Tweetinvi: Store and use authenticated user credentials later
body: <p>I am using Tweetinvi to authenticate users by using ASP C# Web Api. To authenticate the user i use the following code (Using <a href="https://linvi.github.io/tweetinvi/dist/authentication/authentication-url-redirect.html" rel="nofollow noreferrer">https://linvi.github.io/tweetinvi/dist/authentication/authentication-url-redirect.html</a> as reference):</p>
  <pre><code>IAuthenticationRequestStore _myAuthRequestStore = new LocalAuthenticationRequestStore();
  var appClient = new TwitterClient(&quot;consumer_key&quot;, &quot;consumer_secret&quot;);
  var authenticationRequestId = Guid.NewGuid().ToString();
  var redirectPath = &quot;https://apisite/api/v1/twittercallback&quot;;
  var redirectURL = _myAuthRequestStore.AppendAuthenticationRequestIdToCallbackUrl(redirectPath, authenticationRequestId);
  var authenticationRequestToken = await appClient.Auth.RequestAuthenticationUrlAsync(redirectURL);
  await _myAuthRequestStore.AddAuthenticationTokenAsync(authenticationRequestId, authenticationRequestToken);
  </code></pre>
  <p>And use the <code>authenticationRequestToken.AuthorizationURL</code> to get the url i redirect the user to.</p>
  <p>This part works fine but the issue ends up being when trying to authenticate the user on callback or in the future. I am storing the following in my database: <code>authenticationRequestId</code> ,  <code>authenticationRequestToken.AuthorizationKey</code>, <code>authenticationRequestToken.AuthorizationSecret</code> from the above code, and the <code>oauth_token</code> and <code>oauth_secret</code> sent by twitter as get parameters when redirecting to the callback url.</p>
  <p>The issue is that i am unable to authenticate user on callback to send a tweet or get user info. It works it i make the variable <code>IAuthenticationRequestStore _myAuthRequestStore = new LocalAuthenticationRequestStore();</code> as global and static (as in the linked example) but that is something that works temporary as whenever if the app is restarted or updated it looses whatever is stored in that.</p>
  <p>I read some old solutionswhere it was mentioned to use Auth or AuthFlow but i am unable to find what needs to be included for the &quot;Auth&quot; or &quot;AuthFlow.CreateCredentialsFromVerifierCode&quot; variable.</p>