Skip to main content
1 of 3
Taco
  • 163
  • 7

Using API with sites like JSFiddle and CodePen?

I am currently working on a prototype for the flair provided by Stack Exchange and can't seem to get the API to work with CodePen. It continuously returns the following error on the SE.init call:

Uncaught channelUrl must be under the current domain.

Is there a way to successfully implement the API on sites like JSFiddle or Codepen? I want to use anonymous authentication, but I'm having trouble connecting to the API and can't seem to find the information I need in the documentation so I've registered my app with the OAuth set to my profile on Codepen, but I believe this doesn't work.

SE.init({
    clientId: 16131,
    key: 's29XM)Eqn2x3YxhjLgFwBQ((',
    channelUrl: 'codepen.io/PerpetualJ/blank', // Issue is here, this isn't a valid path.
    complete: function (data) { fetch(); }
});
function fetch() {
    var info = SE.users('9893154');
}

My whole goal is to pull user information and so in reality I'd only need the users{id} method, which I believe I may be implementing incorrectly as well.

Is it possible to use the API with sites like JSFiddle or Codepen for rapid web debugging and demonstrations?

Taco
  • 163
  • 7