C
C#3mo ago
Jorjo

Depndency injected IConfiguration returning null.

Hello. I have a little school project that I'm doing and I'm in charge of making a little authentication ASP microservice for our app. It's been going well so far except I've kind of reached a dead end with one of our service methods namely the LoginUser() one, now it's utilities are working well and generating what they have to, and I trust that they'll do their job but the issue mainly comes from the fact that the paramaters they are being passed are null, I get those paramaters from builder.Configuration and that is dependency injected into the AuthService constructor and later used in the LoginUser() method. Obviously with a null value we can't the utilities to work and we get no tokens. So I'm at a loss. If anyone has experienced this type of error before, help would be greatly appreciated.
No description
23 Replies
Jorjo
JorjoOP3mo ago
No description
Jorjo
JorjoOP3mo ago
No description
Sehra
Sehra3mo ago
$paste
MODiX
MODiX3mo ago
If your code is too long, you can post to https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code!
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
taner.
taner.3mo ago
are the spelling properties identical to those in the config file?
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Jorjo
JorjoOP3mo ago
"JWTSettings": {
"SecretKey": "testkey",
"Issuer": "Reeltok",
"Audience": "Reeltok-User"
},
"JWTSettings": {
"SecretKey": "testkey",
"Issuer": "Reeltok",
"Audience": "Reeltok-User"
},
Yes exactly the same.
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Jorjo
JorjoOP3mo ago
GitHub
H3_The_ReelTok/reeltok.api/reeltok.api.auth at feature/Auth · Magnu...
A less attractive alternative to TikTok. Contribute to MagnusHLund/H3_The_ReelTok development by creating an account on GitHub.
taner.
taner.3mo ago
are the other objects correctly loaded in the config?
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
taner.
taner.3mo ago
yeah
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Jorjo
JorjoOP3mo ago
that was for debugging actually :droidcry: I'll try
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
taner.
taner.3mo ago
Another suggestion I have is to work with ProblemDetails, which is the RFC standard for API error responses.
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Jorjo
JorjoOP3mo ago
Man wow, thanks a lot for the feedback like I said it's a school project and we're pressing down a week to implement this whole thing.
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
taner.
taner.3mo ago
Or make an BLL and DAL layer
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Jorjo
JorjoOP3mo ago
Anyway I'll consider some of these things for tomorrow when I write to the other contributors, thanks a lot again, the issue is fixed now, you were a huge help.

Did you find this page helpful?