Problem/Motivation
Creation media entity failed due to validation of field Instagram URL (field_media_oembed_instagram_1) with message "The provided URL does not represent a valid oEmbed resource"
Steps to reproduce
1. Download and install module using composer
2. Set "App id" and "App secret" in /admin/config/media/instagram-settings
3. Add new media type /admin/structure/media/add
- Media source = Instagram
- Field with source information = Create
4. Add new entity instance /media/add/{new name}
- Instagram URL=https://www.instagram.com/p/CAYbO7MANtt/
Results:
1 error has been found: Instagram URL
The provided URL does not represent a valid oEmbed resource.
Direct API request working well
https://graph.facebook.com/v9.0/instagram_oembed?url=https://www.instagram.com/p/CAYbO7MANtt/&access_token={app id}|{app secret}
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | media_entity_instagram-use_graph_api-3190830-9.patch | 698 bytes | Jill L |
Issue fork media_entity_instagram-3190830
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dimonuga commentedComment #3
superfluousapostrophe commentedI'm getting the same error. Looking in the logs shows this message:
Comment #4
bkosborneRe: #3, that sounds like you're on the old version of the module. You need to upgrade to the latest version and set up a Facebook App and input the App ID and Secret in config.
For the original post, it may be that your Facebook App does not have the Instagram OEmbed product added. You also need to initiate the App Review process, though it's a simple process that happens automatically. This is what happened to me and I had the same generic error. The media entity will fail validation if it cannot download the oembed data. I used xdebug to get the HTTP response message from the oEmbed request.
This, I suspect, is really a documentation issue.
Comment #7
joewhitsittWe were reviewing 3.0.4 in preparation for D9 and noticed this issue as well for 3.0.4 and our existing version. We are using the Facebook App for media_entity_facebook and don't have any issues with the app status/credentials. This appears to grab the deprecated https://api.instagram.com/oembed endpoint which is now second in the endpoints array. This removes that as GraphAPI is now first in endpoints.
Comment #8
joewhitsittComment #9
Jill LHaving the exact same problem as joewhitsitt: the order of the endpoints has changed, and the code was using the old oembed one.
Uploading a patch of the diff, to have a static version for use in Composer projects.
Comment #10
useernamee commentedI've encountered the same issue with media_entity_instagram version 3.0.4 and this patch solves our issue. Moving into RTBC.
It might be worth adding that current code in
media_entity_instagram_oembed_resource_url_alter()is very susceptible for bugs. It would be better to check endpoints with a regex or sth if they match a condition instead of just hoping that sort order will stay the same.
Comment #11
acbramley commented#9 fixed the same issue for me, thanks! I also agree with #10, wondering if there should be some testing around this?
Comment #12
OCTOGONE.dev commentedI am unable to get this working this on Drupal 8.9.
Can we have a status on this. Are you planning to release a new version that correct this problem? Date?
Thank you.
Comment #13
chr.fritschSince https://github.com/iamcal/oembed/pull/515 was merged, this shouldn't be an issue anymore.
Comment #14
OCTOGONE.dev commented@ chr.fritsch
After patching with #9 and testing the last version of oembed module, it does not resolve this problem, i still have the message "The provided URL does not represent a valid oEmbed resource."
Instagram URL tested : https://www.instagram.com/p/CJUJXSgJgDi.
Thus is suppose this is not related with the oembed module, but with this instagram module
Comment #15
rockaholiciam commentedI am getting the same message but I thought it was because instagram doesn't allow linking to another accounts images images anymore. Can you link to any instagram post or only those posted by your own account?
Comment #16
amstercadUsing the latest Drupal 9.2.6, patch #9 doesn't seem to do anything, and I also see the error message, "The provided URL does not represent a valid oEmbed resource.".
Comment #17
osopolarFWIW, under app-review > permissions and features you may read the following note:
So you probably need to request advanced access for "Oembed Read". I will leave a comment here if it worked (currently the request is pending).
Comment #18
szeidler commentedThe patch in #9 seems not to resolve the issue anymore. I also suspect that it's related to the new access levels described in #17. Or will the patch be required and helping if you want to embed instagram content from your own account?
Have you succeeded the review phase? Has it resolved the problem?
Comment #19
joewhitsittI'll chime into say, my org is no longer using this MR/patch because of #13. My org had to go through a review process for oembed read. We haven't had issues since.
Comment #20
nivethitha commentedyes. "Oembed Read" access approved. now working fine with instagram post on site. we need to follow few steps for getting it,
1. login on https://developers.facebook.com/
2. create app using this: https://developers.facebook.com/docs/development/create-an-app/
3. After app creation, request for ombed read and submit
4. give valid info about app and get permission and submit for app review
5. within 5days will get the access of it
6. use your app id and secret on instagram setting config then normally we can use instagram feed in content
Comment #21
a.milkovskyI guess this issue can be closed as outdated, as there was no activity for 1 year. Also the patched lines do not exist anymore.
Comment #22
chr.fritsch