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

New Here ,
Dec 07, 2021 Dec 07, 2021

Copy link to clipboard

Copied

Like this

 

appsettingsjson.png

Views

71

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 07, 2021 Dec 07, 2021

Copy link to clipboard

Copied

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. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 15, 2021 Dec 15, 2021

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 15, 2021 Dec 15, 2021

Copy link to clipboard

Copied

LATEST

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. 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources