Share on facebook page throwing an error
Asked Answered
L

2

20

When I'm sharing on Facebook page, getting following error :

(#100) Only owners of the URL have the ability to specify the picture, name, thumbnail or description params.

It was working fine 5-10 days ago. When searched I found following on Facebook developer site link :

"As of November 7, 2017, link customization is available however the link must be owned by the posting page and a page access token is required. To verify ownership, check the ownership_permissions{can_customize_link_posts} field on the URL node. See our Link Ownership Guide for more information. For versions 2.10 and lower, picture, name, thumbnail, and description are deprecated. caption is deprecated for all versions."

Any help would be appreciated!

ShareLinkContent content = new ShareLinkContent.Builder()
            .setContentUrl(Uri.parse(shareUrl))
            .build();

new ShareApi(content).share(new FacebookCallback<Sharer.Result>() {

        @Override
        public void onSuccess(Sharer.Result result) {
            shareCallback.onSuccess(result);
        }

        @Override
        public void onCancel() {
            shareCallback.onCancel();
        }

        @Override
        public void onError(FacebookException error) {
            shareCallback.onError(error);
        }
    });
Lassiter answered 4/1, 2018 at 16:4 Comment(4)
how exactly are you trying to share? please include your code.Kennet
@luschn : I edited my question, please have a look!Lassiter
ok, so you really only try to share the url, no additional parameters?Kennet
@luschn : Yes we are sharing only urlLassiter
U
5

From what I know this is a very recent change to the facebook api. It requires the page editors to add a metatag with the page id.

https://developers.facebook.com/docs/sharing/opengraph/object-properties?hc_location=ufi

On that page please look for fb:pages

Here's the description of fb:pages

One or more Facebook Page IDs that are associated with a URL in order to enable link editing and instant article publishing.

In short you need to add <meta property="fb:pages" content="PAGE_ID"> in order to edit the share content.

Unhappy answered 16/1, 2018 at 23:36 Comment(0)
P
2

i have implemented it by using ShareDialog here is the code

CallbackManager callbackManager;
ShareDialog shareDialog;
shareDialog = new ShareDialog(this);
shareDialog.registerCallback(callbackManager, new FacebookCallback<Sharer.Result>() {
                @Override
                public void onCancel() {

                }

                @Override
                public void onError(FacebookException error) {

                }

                @Override
                public void onSuccess(Sharer.Result result) {

                }
            });
if (ShareDialog.canShow(ShareLinkContent.class)) {
                    ShareLinkContent linkContent = new ShareLinkContent.Builder()
                            .setShareHashtag(new ShareHashtag.Builder()
                                    .build())
                            .setContentUrl(Uri.parse(shareUrl))
                            .build();
                    shareDialog.show(linkContent);
                }

i hope it can help you

Prut answered 16/1, 2018 at 15:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.