I have a React project with API (net core). My website menus/fields will be shown/hidden based on the Role
of the user. The user will login to my website via external oidc.
However, the access_token
and id_token
coming from the oidc doesn't have the Role
information, it will only have their email
, which I will use to check against my Database to determine which Role
is the logged in user. Currently I have an API to get Role
based on their access_token
, so it's something like
public string getRoles(string access_token)
{
//check Database
return role;
}
This function will be called in almost every page so I was wondering is there any more efficient way to do this?