自我将Firebase应用程序升级到新控制台(仅限)后,Facebook登录不再起作用

Ant*_*ony 7 android facebook-graph-api facebook-authentication firebase firebase-authentication

我有一个具有Facebook和电子邮件登录功能的应用程序,因为我升级了Firebase控制台(仅限,sdk尚未更新).

Firebase 3.0之前的应用程序发布之前,但在控制台升级后,它不再能够使用Facebook签名/登录.

我做了什么:

1 - 升级Firebase控制台

由于Firebase和Facebook控制台更新,我还必须将Oauth回调放到Facebook应用程序中

2 -粘贴的火力地堡的Facebook的OAuth回调至Facebook的控制台(这是无效之前)` https://xxx.firebaseapp.com/__/auth/handler ``

例外情况:

firebase Auth侦听器触发Firebase错误:

提供的身份验证凭据无效.和Facebook:{ "providerErrorInfo":{ "代码":400, "消息": "从Facebook不成功debug_token响应:{\" 错误\ ":{\" 消息\ ":\"(#100)必须提供一个应用程序访问令牌或用户访问令牌是app \",\"类型\"的所有者或开发者:\"OAuthException \",\"code \":100,\"fbtrace_id \":\"DG4lLRJHFBS\"}}"}}

FirebaseError代码:

在FirebaseAndroidSdk的反编译代码中,错误对象是:

0 = {java.util.LinkedHashMap$LinkedEntry@22680}"code" - >"INVALID_CREDENTIALS"

1 = {java.util.LinkedHashMap$LinkedEntry@22681}"message" - >"提供的身份验证凭据无效."

2 = {java.util.LinkedHashMap$LinkedEntry@22682}"details" - >"{"providerErrorInfo":{"code":400,"message":"来自Facebook的不成功的debug_token响应:{\"error \":{ \"message \":\"(#100)您必须提供应用访问令牌或用户访问令牌,该令牌是应用的所有者或开发者,"\"键入\":\"OAuthException \",\"代码\ ":100,\" fbtrace_id\":\" BtB3JF2qmku\"}}"}}"

使用反编译代码:

private void makeAuthenticationRequest(String urlPath, Map<String, String> params, AuthResultHandler handler) {
    final AuthenticationManager.AuthAttempt attempt = this.newAuthAttempt(handler);
    this.makeRequest(urlPath, HttpRequestType.GET, params, Collections.emptyMap(), new RequestHandler() {
        public void onResult(Map<String, Object> result) {
            Object errorResponse = result.get("error");
            String token = (String)Utilities.getOrNull(result, "token", String.class);
            if(errorResponse == null && token != null) {
                if(!AuthenticationManager.this.attemptHasBeenPreempted(attempt)) {
                    AuthenticationManager.this.authWithCredential(token, result, attempt);
                }
            } else {
                FirebaseError error = AuthenticationManager.this.decodeErrorResponse(errorResponse);
                AuthenticationManager.this.fireAuthErrorIfNotPreempted(error, attempt);
            }

        }

        public void onError(IOException e) {
            FirebaseError error = new FirebaseError(-24, "There was an exception while connecting to the authentication server: " + e.getLocalizedMessage());
            AuthenticationManager.this.fireAuthErrorIfNotPreempted(error, attempt);
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

在AuthListener级别,firebaseError代码: -20

https://www.firebase.com/docs/java-api/javadoc/com/firebase/client/FirebaseError.html

指定的身份验证凭据无效.

Facebook错误代码:

400

这里没有任何相关内容:https://developers.facebook.com/docs/graph-api/using-graph-api/#errors

Authing的代码:

    public void authWithFirebase(final String provider, Map<String, String> options) {
        if (options.containsKey(AUTH_OPTIONS_ERROR)) {
            EventBus.getDefault().post(new MessageToDisplayEvent(options.get(AUTH_OPTIONS_ERROR), true));
        } else {
            if (provider.equalsIgnoreCase(AUTH_PROVIDER_TWITTER)) {
                // if the provider is twitter, we must pass in additional options, so use the options endpoint
                ref.authWithOAuthToken(provider, options, new AuthResultHandler(provider));
            } else {
                // if the provider is not twitter, we just need to pass in the oauth_token
                ref.authWithOAuthToken(provider, options.get(AUTH_OPTIONS_TOKEN), new AuthResultHandler(provider));
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

TOKEN有效期:

从上面的代码中,令牌被确认有效,因为:

https://graph.facebook.com/app?access_token=%7Byour_access_token%7D返回有效的JSON

并且Facebook工具AccessToken https://developers.facebook.com/tools/debug/accesstoken返回仍然有效的TOKEN

从用户的角度来看有什么变化:

现在,当我点击FacebookLoginButton时,我有一个新的对话框,询问"连接为%FacebookUserName",有2个按钮("Unconnect"和"Cancel")

我在Firebase上发布了一个错误报告,但我甚至不知道这是Facebook还是Firebase,任何帮助,建议探索新的问题表面或解决方案是值得欢迎的.

Ant*_*ony 19

在Facebook Developper Console中,关闭关于"集成在客户端中的应用程序密钥"的选项.

对我来说,这改变了行为.我将从Firebase/Facebook获取更多信息

这是一个法语截图,可以帮助您设置Facebook:

在此输入图像描述