Open Closed

Getting cors origin issue with external urls #10616


0
shedspotter created

Hi, I am getting cors origin issue with following urls. https://api.giphy.com/v1/gifs https://g.tenor.com/v1 Thanks

Prerequisites
  • What is your product version? 10.3.0
  • What is your product type? Angular
  • What is product framework type? .net core

9 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Could you share how do you use these URLs in your app ?

    Thanks,

  • 0
    shedspotter created
    /* Tenor API */
    getTrending(page: number): Observable<HttpResponse<any>> {
        const limit = 100;
        const url = `${environment.tenorEndpoint}/trending?key=${environment.tenorApikey}&limit=${limit}&contentfilter=high`;
        return this.http.get<any>(url, { observe: 'response' });
    }
    
    /* Giphy API */
    getTrending(page: number): Observable<HttpResponse<any>> {
        const url = `${this.giphyUrl}/trending?api_key=${this.giphyApiKey}&limit=100;&offset=${page}&tag=&rating=g`;
        return this.http.get<any>(url, { observe: 'response' });
    }
    

  • 0
    ismcagdas created
    Support Team

    Hi,

    Are you able to call those URLs using a tool like Postman ?

  • 0
    shedspotter created

    I have able to access same url in separator demo angular app.

  • 0
    shedspotter created

    I am also able to access using "https://www.thunderclient.io/"

  • 0
    shedspotter created

    Hi 👋 Any luck? 🤔

  • 0
    ismcagdas created
    Support Team

    Hi @shedspotter

    Sorry for the delay on my reply. Since these tools are non-web apps, they will not be checked by CORS policy. Is the app you are getting CORS error hosted as HTTP or HTTPS ?

    It might be similar to this one

  • 0
    shedspotter created

    Hi @ismcagdas

    Sorry for the delay on my reply. I am still not able to access external url. I tried above stackoverflow trick but not working.

  • 0
    ismcagdas created
    Support Team

    Hi **@shedspotter **

    Is it possible to share your app (or a new AspNet Zero app with this problem) ? We can check the problem and find the problem faster in that way.

    Thanks,