android-找不到客户端令牌,请设置客户端令牌

android-找不到客户端令牌,请设置客户端令牌,第1张

概述我正在尝试使用android中的facebook创建登录名,并且遇到了这个问题.我不确定我看不到或设置了什么.我尝试设置应用程序令牌/客户端机密,但是它一直失败.下面是我的代码:清单文件<?xmlversion="1.0"encoding="utf-8"?><manifestxmlns:android="http://schemas.android.com/a

我正在尝试使用android中的facebook创建登录名,并且遇到了这个问题.我不确定我看不到或设置了什么.

我尝试设置应用程序令牌/客户端机密,但是它一直失败.

下面是我的代码:
清单文件

<?xml version="1.0" enCoding="utf-8"?><manifest xmlns:androID="http://schemas.androID.com/apk/res/androID"    xmlns:tools="http://schemas.androID.com/tools"    package="com.test.app">    <application        androID:allowBackup="true"        androID:icon="@mipmap/ic_launcher"        androID:label="@string/app_name"        androID:supportsRtl="true"        androID:theme="@style/Apptheme">        <activity androID:name=".SplashScreenActivity">            <intent-filter>                <action androID:name="androID.intent.action.MAIN" />                <category androID:name="androID.intent.category.LAUNCHER" />            </intent-filter>        </activity>        <activity androID:name=".FacebookLoginActivity">            <intent-filter>                <action androID:name="androID.intent.action.FACEBOOK_LOGIN" />                <category androID:name="androID.intent.category.DEFAulT" />            </intent-filter>        </activity>        <activity            androID:name="com.facebook.FacebookActivity"            androID:configChanges="keyboard|keyboardHIDden|screenLayout|screenSize|orIEntation"            androID:label="@string/app_name"            androID:theme="@androID:style/theme.Translucent.NoTitlebar"            tools:replace="androID:theme" />        <activity androID:name=".MainActivity">            <intent-filter>                <action androID:name="androID.intent.action.MAINACTIVITY" />                <category androID:name="androID.intent.category.DEFAulT" />            </intent-filter>        </activity>        <Meta-data androID:name="com.facebook.sdk.ApplicationID" androID:value="@string/facebook_app_ID"/>    </application>    <uses-permission androID:name="androID.permission.INTERNET" /></manifest>

Facebook登录活动

 package com.test.app;    public class FacebookLoginActivity extends AppCompatActivity {        private TextVIEw info;        private Loginbutton loginbutton;        private CallbackManager callbackManager;        @OverrIDe        public voID onCreate(Bundle bundle) {            super.onCreate(bundle);            FacebookSdk.sdkInitialize(getApplicationContext());            callbackManager = CallbackManager.Factory.create();            setContentVIEw(R.layout.facebook_login);            info = (TextVIEw) findVIEwByID(R.ID.info);            loginbutton = (Loginbutton) findVIEwByID(R.ID.login_button);            loginbutton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {                @OverrIDe                public voID onSuccess(LoginResult loginResult) {                    info.setText(                            "User ID: "                                    + loginResult.getAccesstoken().getUserID()                                    + "\n" +                                    "Auth Token: "                                    + loginResult.getAccesstoken().getToken()                    );                }                @OverrIDe                public voID onCancel() {                    info.setText("Login attempt canceled.");                }                @OverrIDe                public voID one rror(FacebookException error) {                    info.setText("Login attempt Failed.");                }            });        }        @OverrIDe        public voID onActivityResult(int requestCode, int resultCode, Intent data) {            super.onActivityResult(requestCode, resultCode, data);            callbackManager.onActivityResult(requestCode, resultCode, data);        }    }

错误

Caused by: java.lang.IllegalStateException: No ClIEnt Token found, please set the ClIEnt Token.                      at com.facebook.internal.ValIDate.hasClIEntToken(ValIDate.java:162)                      at com.facebook.login.DeviceAuthDialog.startLogin(DeviceAuthDialog.java:178)                      at com.facebook.login.DeviceAuthMethodHandler.showDialog(DeviceAuthMethodHandler.java:51)                      at com.facebook.login.DeviceAuthMethodHandler.tryAuthorize(DeviceAuthMethodHandler.java:42)                      at com.facebook.login.LoginClIEnt.tryCurrentHandler(LoginClIEnt.java:254)                      at com.facebook.login.LoginClIEnt.tryNextHandler(LoginClIEnt.java:216)                      at com.facebook.login.LoginClIEnt.authorize(LoginClIEnt.java:121)                      at com.facebook.login.LoginClIEnt.startOrContinueAuth(LoginClIEnt.java:102)                      at com.facebook.login.LoginFragment.onResume(LoginFragment.java:153)                      at androID.support.v4.app.Fragment.performResume(Fragment.java:2230)                      at androID.support.v4.app.FragmentManagerImpl.movetoState(FragmentManager.java:1343)                      at androID.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1523)                      at androID.support.v4.app.FragmentManagerImpl.movetoState(FragmentManager.java:1585)                      at androID.support.v4.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:2842)                      at androID.support.v4.app.FragmentController.dispatchResume(FragmentController.java:223)                      at androID.support.v4.app.FragmentActivity.onResumeFragments(FragmentActivity.java:509)                      at androID.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:498)                      at androID.app.Activity.performResume(Activity.java:6807)                      at androID.app.ActivityThread.performResumeActivity(ActivityThread.java:3406)                      at androID.app.ActivityThread.handleResumeActivity(ActivityThread.java:3469)                       at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2732)                       at androID.app.ActivityThread.-wrap12(ActivityThread.java)                       at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) 

解决方法:

您需要像这样将应用程序客户端令牌添加到AndroIDManifest中:

<Meta-data        androID:name="com.facebook.sdk.ClIEntToken"        androID:value="@string/facebook_clIEnt_token"/>

您可以在Facebook信息中心中找到您的应用客户端令牌->设置->高级(在“安全性”部分)

总结

以上是内存溢出为你收集整理的android-找不到客户端令牌,请设置客户端令牌全部内容,希望文章能够帮你解决android-找不到客户端令牌,请设置客户端令牌所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1120952.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存