我正在开发一个使用 Twitter 和电子邮件登录的 android 应用程序。我实现了 com.firebaseui:firebase-ui-auth:5.0.0。然后我正在检查用户是否已经登录,如果没有启动 FirebaseUI Auth 提供的登录活动:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
firebaseAuth = FirebaseAuth.getInstance();
List<AuthUI.IdpConfig> providers = Arrays.asList(
new AuthUI.IdpConfig.EmailBuilder().build(),
new AuthUI.IdpConfig.TwitterBuilder().build());
if (firebaseAuth.getCurrentUser() == null) {
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setAvailableProviders(providers)
.setIsSmartLockEnabled(true)
.build(),
RC_SIGN_IN);
} else {
for (UserInfo profile : firebaseAuth.getCurrentUser().getProviderData()) {
if (profile.getProviderId().equals(TwitterAuthProvider.PROVIDER_ID)) {
// UID specific to the provider
String uid = profile.getUid();
String name = profile.getDisplayName();
String email = profile.getEmail();
Uri photoUrl = profile.getPhotoUrl();
}
}
startActivity(new Intent(this,MainActivity.class));
}
使用这种方法,我可以使用我的 Twitter 帐户登录并声明我的基本 Twitter 信息,例如姓名、电子邮件、照片 URL。但是,当我转到原始Twitter android 应用程序 > 设置 > 帐户 > 应用程序和会话并撤销对我的应用程序的访问权限,然后尝试再次打开我的应用程序时,我仍然可以索取我的 Twitter 信息。我想知道用户何时撤销对我的应用程序的访问权限,并且每当他们这样做时,我希望他们注销。我想知道如何克服这个问题,我也想知道这是否是这种情况的最佳做法。提前致谢。