Skip to main content
Known Participant
December 7, 2021
Question

For Blazor app, how to reference clientID, Secret Key, etc from appsettings.json

  • December 7, 2021
  • 1 reply
  • 830 views

Like this

 

    This topic has been closed for replies.

    1 reply

    Raymond Camden
    Community Manager
    Community Manager
    December 7, 2021

    You can't, securely, use PDF Services via a client-side application. You need to have server-side code to act as a proxy. I haven't used Blazor, but if I were building a VueJS SPA, or any other front-end only app, I'd combine it with Amazon Lambda, Azure Functions, or other serverless providers, so that I could make the calls to that code, have it make the secured call to our APIs, and then pass the result back to the front end. 

    Known Participant
    December 15, 2021

    That makes sense. You don't want customers triggering these requests straight from their browser, but that shouldn't be a problem for Blazor Server-side apps which is what this app is using. I didn't specify that this app is not a Blazor WebAssembly (client-side) app but a server-side one, so that's my mistake.

     

    Since this problem was posted, I've managed to connect these values hard-typed in appsettings.json using .Net's IConfiguration so I think I'm good, but if I'm missing anything or should be aware of anything else please let me know.

    Raymond Camden
    Community Manager
    Community Manager
    December 15, 2021

    I'm not a DotNet person, but that sounds cool to me. In Node, I use environment variables, and when testing locally, dotenv, to make it simpler.