adobe/aem-core-wcm-components

Enable access token for OEmbed Client

bpauli opened this issue · 2 comments

Feature Request

Some oEmbed endpoints require an access token for embedding. For example:
Instagram: https://developers.facebook.com/docs/instagram/oembed/
Facebook: https://developers.facebook.com/docs/plugins/oembed?locale=en_US

The generic oEmbed URL processor doesn't provide a generic way to add this token to the request at the moment.

Describe the solution you'd like
If an endpoint needs an access token the URL processor should be able to make a lookup for an context-aware configuration which is providing this token for the request.

A possible workaround for the oEmbed endpoint of Facebook is to add the access token to the endpoint URL in the OSGi configuration. The Instagram configuration for example would look like:

provider="Instagram"
endpoint="https://graph.facebook.com/v8.0/instagram_oembed?access_token=72...%7C89..."
format="json"
scheme=["https?://(www\\.)?instagram\\.com/p/.*","https?://(www\\.)?instagr\\.am/p/.*"]
unsafeContext="true"

Note that the access token is a combination of {app-id}|{client-id} according to the official Facebook documentation but the pipe character needs to be provided in a uri encoded string {app-id}%7C{client-id}

Hi @bpauli
I tried with the workaround as you suggested and now I am getting response 200 for Instagram request but everything is null and empty in response(Below is the screenshot). Is something wrong I am doing here?
image