gpt4 book ai didi

java - 如何在Java中使用instagram_graph_user_profile权限

转载 作者:行者123 更新时间:2023-12-01 18:07:53 29 4
gpt4 key购买 nike

我搜索了很多有关如何在 Java 中使用 instagram_graph_user_profile 权限的信息,但找不到任何相关内容。

这是我的代码:

private void init_instagram() {
FacebookSdk.setApplicationId(getString(R.string.facebook_app_id));
FacebookSdk.sdkInitialize(this.getApplicationContext());
if (BuildConfig.DEBUG) {
FacebookSdk.setIsDebugEnabled(true);
FacebookSdk.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
}
callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), (object, response) -> {
if (object != null) {
Log.e(TAG, object.toString());
} else {
Log.e(TAG, "null");
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "instagram_graph_user_profile");//instagram_graph_user_profile
request.setParameters(parameters);
request.executeAsync();
}

@Override
public void onCancel() {
Log.e(TAG, "onCancel");
}

@Override
public void onError(FacebookException exception) {
Log.e(TAG, exception.toString());
}
});
}

当我按下按钮时:

connectInstagram.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LoginManager.getInstance().logInWithReadPermissions(MyProfileActivity.this,
Arrays.asList("instagram_graph_user_profile"));
}
});

它返回此错误消息:

Unsupported get request. Object with ID '2674********80' does not exist, cannot be loaded due to missing permissions, or does not support this operation

并重定向到 Facebook 页面,并显示消息“抱歉,出了点问题。我们正在处理该问题,我们会尽快修复它。”

或者在控制台日志中给我这个错误:

E/GraphResponse: {HttpStatus: 400, errorCode: 104, subErrorCode: -1, errorType: OAuthException, errorMessage: An access token is required to request this resource.}

最佳答案

我搜索了很多有关如何在 Java 中使用 instagram_graph_user_profile 权限的信息,但找不到任何相关内容。

这是我的代码:

private void init_instagram() {
FacebookSdk.setApplicationId(getString(R.string.facebook_app_id));
FacebookSdk.sdkInitialize(this.getApplicationContext());
if (BuildConfig.DEBUG) {
FacebookSdk.setIsDebugEnabled(true);
FacebookSdk.addLoggingBehavior(LoggingBehavior.INCLUDE_ACCESS_TOKENS);
}
callbackManager = CallbackManager.Factory.create();
LoginManager.getInstance().registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), (object, response) -> {
if (object != null) {
Log.e(TAG, object.toString());
} else {
Log.e(TAG, "null");
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "instagram_graph_user_profile");//instagram_graph_user_profile
request.setParameters(parameters);
request.executeAsync();
}

@Override
public void onCancel() {
Log.e(TAG, "onCancel");
}

@Override
public void onError(FacebookException exception) {
Log.e(TAG, exception.toString());
}
});
}

当我按下按钮时:

connectInstagram.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LoginManager.getInstance().logInWithReadPermissions(MyProfileActivity.this,
Arrays.asList("instagram_graph_user_profile"));
}
});

它返回此错误消息:

Unsupported get request. Object with ID '2674********80' does not exist, cannot be loaded due to missing permissions, or does not support this operation

并重定向到 Facebook 页面,并显示消息“抱歉,出了点问题。我们正在处理该问题,我们会尽快修复它。”

或者在控制台日志中给我这个错误:

E/GraphResponse: {HttpStatus: 400, errorCode: 104, subErrorCode: -1, errorType: OAuthException, errorMessage: An access token is required to request this resource.}

关于java - 如何在Java中使用instagram_graph_user_profile权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60526903/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com