# Embedding pens from CodePen

**URL:** <https://meta.discourse.org/t/embedding-pens-from-codepen/13578>\
**Category:** Feature\
**Created:** [March 9, 2014, 9:56pm UTC](https://meta.discourse.org/t/embedding-pens-from-codepen/13578 "2014-03-09T21:56:57Z")\
**Posts on this page:** 1\
**Showing post:** 54

<div class="post-metadata">

**Author:** ![Roman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roman/32/157504_2.png) [@Roman](https://meta.discourse.org/u/Roman)\
**Post date:** [April 15, 2019, 5:06pm UTC](https://meta.discourse.org/t/embedding-pens-from-codepen/13578/54 "2019-04-15T17:06:27Z")

</div>

Thanks for jumping in so quickly @chriscoyier!

This happens when I try to onebox the link using the gem, the request is being done from Ruby’s `Net::HTTP`.

The flow is:

1. Fetch Codepen’s HTML (e.g. GET to [https://codepen.io/web-tiki/full/dNpgrR](https://codepen.io/web-tiki/full/dNpgrR)).
2. Discover the oEmbed URL from the `application/json+oembed` header tag.
3. Fetch oEmbed data and build the box.

We never reach step number 2.

Onebox can also work outside of Discourse since it’s a standalone gem, so I don’t think we can rely on a referrer. On the other hand, we could possibly set a specific user-agent that can be allowed on your side? (Is this acceptable, @sam?)

---

_[View the full topic](https://meta.discourse.org/t/embedding-pens-from-codepen/13578)._
