Using an API Key in Blazor Server App?

Posted by: hellokaisahaijohaivohai on 2 December 2020, 3:18 am EST

    • Post Options:
    • Link

    Posted 2 December 2020, 3:18 am EST

    I’m currently learning ASP.NET and I’m building my first Blazor Server app. I’m having trouble figuring out where and how to incorporate my API key for an API I’m trying to utilize in my app.

    Right now I’m able to make REST calls to an open API. I’m using an HttpClient factory for that. Now I’m trying to access a private API which I have a personal key for but I can’t figure out where to actually put the key*. I’m also having a hell of a time finding results on Google because of a ton of blog spam (and also articles for Blazor WebAssembly keep showing up - even more than Blazor Server…).

    Thanks!

  • Posted 2 December 2020, 9:08 pm EST

    Hello,

    The HttpClient method is a part of .Net and not only Blazor. So, you do not need to search for this exclusively for Blazor. Most probably, the key should be sent along with the request headers of the request. Please try the solution from the StackOverflow link below:

    https://stackoverflow.com/a/54695555

    Note that this forum is for ASP.NET MVC or MVCCore applications and not for Blazor. Also, this forum is for issues related to Grapecity products. If you are using Grapecity’s Blazor control, please let us know which control you are using and what exact issue are you facing with the said control.

    Regards,

    Ashwin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels