问题
I would like to get a user id and user access token from Twitter in a Xamarin app. I would prefer to use a library if possible like Xamarin.Auth.
There is a nice description here how to do it: https://mobileprogrammerblog.wordpress.com/2016/01/23/xamarin-android-twitter-authentication/
In short:
var auth = new XA.OAuth1Authenticator(
consumerKey: "CONSUMER_KEY",
consumerSecret: "CONSUMER_SECRET", // THIS IS THE PROBLEM
requestTokenUrl: new Uri("https://api.twitter.com/oauth/request_token"),
authorizeUrl: new Uri("https://api.twitter.com/oauth/authorize"),
accessTokenUrl: new Uri("https://api.twitter.com/oauth/access_token"),
callbackUrl: new Uri("http://mobile.twitter.com/"));
BUT! That is insecure because it requires the app-secret, or consumer secret (or call it anything) which should not be included in any app. Facebook, Google and Microsoft (among others) are able to provide an SDK which uses other methods to authenticate the apps, so the apps can authenticate the users without containing their app-secret in the code.
Once again: I want to get the authenticated user's ID and his/her access-token. How to do it with Twitter?
来源:https://stackoverflow.com/questions/65037403/how-to-securely-authenticate-users-with-twitter-on-xamarin-mobile-apps