rafalz
rafalz
CC#
Created by rafalz on 5/14/2023 in #help
❔ The built-in authentication is not working
Yes - for this reason, because I overcomplicated the flow and the authorization itself 😦
35 replies
CC#
Created by rafalz on 5/14/2023 in #help
❔ The built-in authentication is not working
Now, using the built-in middleware, everything works correctly 🙂 https://github.com/rafalzzz/online-store-api/pull/6/files
35 replies
CC#
Created by rafalz on 5/14/2023 in #help
❔ The built-in authentication is not working
I think I will be able to do it now using the built-in authorization middleware - I will test it later and let you know the details
35 replies
CC#
Created by rafalz on 5/14/2023 in #help
❔ The built-in authentication is not working
Probably because in the authentication middleware, I was passing the token to the 'authorization' header instead of decrypting the token and passing the claims to the 'User' or even 'Role' contex
35 replies
CC#
Created by rafalz on 5/14/2023 in #help
❔ The built-in authentication is not working
Ok, I'll change this 🙂
35 replies
CC#
Created by rafalz on 5/14/2023 in #help
❔ The built-in authentication is not working
Yes, everything is functioning correctly - in your opinion, can I leave it as it is?
35 replies
CC#
Created by rafalz on 5/14/2023 in #help
❔ The built-in authentication is not working
35 replies
CC#
Created by rafalz on 5/14/2023 in #help
❔ The built-in authentication is not working
Yes, but today I continued working on this issue and created a class that takes over the context after the "CookieAuthenticationMiddleware" and checks if the user's claims contain claims of type "Role" with the value "Admin". I have no idea if this approach is good. https://github.com/rafalzzz/online-store-api/blob/master/Authentication/CookieAuthenticationMiddleware.cs https://github.com/rafalzzz/online-store-api/blob/master/Authorization/AdminOnly.cs
35 replies
CC#
Created by rafalz on 5/14/2023 in #help
❔ The built-in authentication is not working
My .env file looks like this:
DB_PORT=5432
DB_HOST=localhost
DB_DATABASE=online_store
DB_USERNAME=online_store_user
DB_PASSWORD=^l23xU&bFr*4Ngn
REDIS_PORT=6379
ONLINE_STORE_CONNECTION_STRING=Host=localhost;Port=5432;Database=online_store;Username=online_store_user;Password=^l23xU&bFr*4Ngn
FRONTEND_DOMAIN=http://127.0.0.1:5173
SECRET_KEY=secretKeyExample
DB_PORT=5432
DB_HOST=localhost
DB_DATABASE=online_store
DB_USERNAME=online_store_user
DB_PASSWORD=^l23xU&bFr*4Ngn
REDIS_PORT=6379
ONLINE_STORE_CONNECTION_STRING=Host=localhost;Port=5432;Database=online_store;Username=online_store_user;Password=^l23xU&bFr*4Ngn
FRONTEND_DOMAIN=http://127.0.0.1:5173
SECRET_KEY=secretKeyExample
35 replies