Do I need a new key?

khargykhargy Registered Users Posts: 13 Big grins
I was working locally on a web app using AJAX calls to the v2 API. I used my old key and it worked just fine. Now when I uploaded it to my website I get an XMLHttpRequest error.

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://hargy.org' is therefore not allowed access. The response had HTTP status code 403.

Comments

  • ktvoelkerktvoelker Registered Users Posts: 25 Big grins
    edited March 24, 2015
    We currently do not have support for cross-origin requests. In the meantime, you can make API requests from your web server, where the browser's same-origin restrictions do not apply.
    Karl Voelker
    Sorcerer and API Guy at SmugMug
  • khargykhargy Registered Users Posts: 13 Big grins
    edited March 24, 2015
    ktvoelker wrote: »
    We currently do not have support for cross-origin requests. In the meantime, you can make API requests from your web server, where the browser's same-origin restrictions do not apply.

    Maybe I'm missing something obvious... but how can I do an AJAX call from the webserver?
  • khargykhargy Registered Users Posts: 13 Big grins
    edited March 24, 2015
    What about JSONP? In the old API I could do:
    http://api.smugmug.com/services/api/json/1.3.0/?Callback=test&method=smugmug.images.getInfo
    

    The callback would change it do JSONP

    That doesn't seem to work with the new one...
  • ktvoelkerktvoelker Registered Users Posts: 25 Big grins
    edited March 26, 2015
    We do not support JSONP in v2, but we are looking into doing something to support your use case.
    Karl Voelker
    Sorcerer and API Guy at SmugMug
  • khargykhargy Registered Users Posts: 13 Big grins
    edited March 29, 2015
    ktvoelker wrote: »
    We do not support JSONP in v2, but we are looking into doing something to support your use case.

    Ok, in the meantime I was able to create a php passthrough page to send the JSON back to the front end. It just needs like an unnecessary step.
Sign In or Register to comment.