im编写应用程序,其中包含所有google auth登录方法。如果我要登录Facebook我有2个问题
GraphMethodException, errorMessage: Unsupported get request. Object with ID 'my app id here' does not exist, cannot be loaded due to missing permissions, or does not support this operation.
ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy
我编写的代码与Firebase文档中的代码相同,生成opens代码等...,但错误仍然显示,并且我无法使用Facebook登录到我的应用程序。
Here is my code:
loginWithFacebook.setPermissions("email", "public_profile")
loginWithFacebook.registerCallback(callbackManager,object:FacebookCallback<LoginResult>{
override fun onSuccess(result: LoginResult?) {
Log.d("TAG","SUCESSS")
authenticate.loginWithFacebook(result!!.accessToken)
}
override fun onCancel() {
Toast.makeText(context,"Login Canceled",Toast.LENGTH_SHORT).show()
Log.d("TAG","Cancell")
}
override fun onError(error: FacebookException?) {
Toast.makeText(context,"Login error ${error!!.message}",Toast.LENGTH_SHORT).show()
Log.d("TAG","ERRRRORRRRR ${error.message}")
}
})
认证课程
fun loginWithFacebook(token:AccessToken){
val credential = FacebookAuthProvider.getCredential(token.token)
auth.signInWithCredential(credential).addOnCompleteListener {task->
if (task.isSuccessful) {
userDetailsViewModel.setInfo(setListOfUserInfo(task.result!!.user))//set info about user account
fragment.findNavController().navigate(R.id.action_facebookLogin_to_userDetailsFragment)//navigate to fragment
} else Toast.makeText(fragment.context, "Error login to account ${task.exception}", Toast.LENGTH_SHORT).show()
}
}