title: Firebase : Facebook authentification with Firebase token not working
body: <p>I'm trying to get working Facebook authentification in my app. </p>
  
  <p>I'm following instructions here : <a href="https://firebase.google.com/docs/auth/ios/facebook-login" rel="nofollow noreferrer">https://firebase.google.com/docs/auth/ios/facebook-login</a></p>
  
  <p>When I clicked on the Facebook login button, everything is working fine : the user is logged. In the facebook login delegate method, it is ok :</p>
  
  <pre><code>    func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!)
  </code></pre>
  
  <p>In this method, I have to create a Firebase token to authenticate finally with Firebase (step 5). This is what I do : </p>
  
  <pre><code>let credential = FacebookAuthProvider.credential(withAccessToken: 
  FBSDKAccessToken.current().tokenString)
              Auth.auth().signIn(with: credential) { (user, error) in
                  if let error = error {
                      print(error.localizedDescription)
                      self.errorServer()
                  } else {
                      FitUtils.setFitUser(user: user)
                  }
              }
  </code></pre>
  
  <p>The problem : My <code>credential</code> variable is not nil, everything is working, but when i'm calling <code>Auth.auth().signIn(...)</code>, the method throwns the <code>error</code> variable, and <code>user</code> is nil. </p>
  
  <p>I don't have many information about the error :</p>
  
  <blockquote>
    <p>An internal error has occurred, print and inspect the error details
    for more information.</p>
  </blockquote>
  
  <p>And </p>
  
  <pre><code>error   NSError domain: "FIRAuthErrorDomain" - code: 17999  0x0000604000640630
  </code></pre>
  
  <p>I suspect an error about the Facebook API key or something like that in the Firebase console, but I already checked everything is fine. </p>
  
  <p>Any idea ? </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I found an explicit description of the error : </p>
  
  <pre><code>UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={
      code = 400;
      errors =     (
                  {
              domain = global;
              message = "Unsuccessful debug_token response from Facebook: {\"error\":{\"message\":\"(#100) You must provide an app access token or a user access token that is an owner or developer of the app\",\"type\":\"OAuthException\",\"code\":100,\"fbtrace_id\":\"GkGVPPBP7vo\"}}";
              reason = invalid;
          }
      );
      message = "Unsuccessful debug_token response from Facebook: {\"error\":{\"message\":\"(#100) You must provide an app access token or a user access token that is an owner or developer of the app\",\"type\":\"OAuthException\",\"code\":100,\"fbtrace_id\":\"GkGVPPBP7vo\"}}";
  }}}}
  (lldb) 
  </code></pre>