Building an add-in tile and getting error about CORS Policy

The error I'm getting is when my tile loads on the screen and it's attempting to get data from the Constituents API:


Access to XMLHttpRequest at 'https://oauth2.sky.blackbaud.com/authorization?client_id=7400c620-5f48-4e98-8c46-468589124ec6&response_type=code&state=carissa&redirect_uri=https://localhost:5001/auth/callback' (redirected from 'https://localhost:5001/api/constituents/280') from origin 'https://localhost:5001' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.


I am using a asp.net CORE app to do the API calls and have already tried the App.UseCors() functionality in my Startup.Configuration function.


Has anyone else run into this? I'd like to get this working on my local machine before putting the code in the cloud (I think that maybe this is only an issue with localhost) but maybe it'll happen in the cloud as well. Any help is appreciated.

Thanks

Comments

  • Michael Tims
    Michael Tims Blackbaud Employee
    Sixth Anniversary Kudos 2 Name Dropper Participant

    Hi @Carissa Malone. Are you also applying a CORS policy and specifying the localhost origin?

    Here's some info in the MS docs for .Net Core: