我无法摆脱“来自Facebook的不成功的debug_token响应”

时间:2019-05-18 21:12:41

标签: javascript firebase react-native facebook-graph-api firebase-authentication

Facebook登录工作正常,但是一旦将代码写入Firebase数据库,我就会不断收到此错误:

Unsuccessful debug_token response from Facebook: {"error":{"message":"(#100) The App_id in the input_token did not match the Viewing App","type":"OAuthException","code":100,"fbtrace_id":"Fx2DQ7XIxqw"}}

我看过无数其他具有相同问题的线程,但是它们都没有帮助。它们大多数都像复制错误的App ID或Secret等一样简单。我已经检查了数十次,以确保我写的内容正确无误,并且错误仍然存​​在。另外,是的,我将OAuth重定向URI添加到了我的Facebook应用配置中。

这是我的身份验证功能:

authenticate = (token) => {
const provider = firebase.auth.FacebookAuthProvider
const credential = provider.credential(token)
return firebase.auth().signInWithCredential(credential)}

我的电话:

login = async () => {
const ADD_ID = '***************'
const options = {
  permissions: ['public_profile', 'email'],
}

try {
const {
  type,
  token,
  expires,
  permissions,
  declinedPermissions,
} = await Facebook.logInWithReadPermissionsAsync(ADD_ID, options);
if (type === 'success') {
  const response = await fetch(`https://graph.facebook.com/me?access_token=${token}`)
  console.log(await response.json())
  this.authenticate(token)
} else {
  // type === 'cancel'
  console.log('cancel')
}
} catch ({ message }) {
  alert(`Facebook Login Error: ${message}`);
  console.log(message)
}}

我只是被困住了,不知道该怎么办。任何帮助表示赞赏。谢谢!

0 个答案:

没有答案