SDK: Auth0.OidcClient.Core 3.2.4
I first implemented Auth0 login in my Xamarin app a couple years ago. I’ve successfully had that working for quite some time. I can authenticate with Google, Facebook, or Twitter. Then I copy the important parts from the ClaimsPrincipal and tuck it away into secure on-device storage (like the keychain on iOS). That all works great.
I’ve just recently starting working on this app again. The problem that I was trying solve in the past and I am now needing to solve again is: how do I get roles and permissions for a given user when they login?
My scenario is this:
My mobile app needs to restrict access to content in the app based on three roles: Admin, Editor, and Public (or the absence of a role). I’ve setup roles and permissions in the Auth0 dashboard, but I’ve never been able to figure out how to either get those pieces of data in the original auth response, or fetch them later after login. I even tried setting up triggers to automatically assign new users to a “public” role, but I’m never able to see that role flow through into the ClaimsPrincipal when a user logs in.
I really need to figure this out, because I’m at the point in development where I need to start restricting some functionality based on roles. Are there any end-to-end examples of how to achieve this?? (I’m not talking about QuickStarts…those don’t go far enough). I spent many many hours trying to figure this out, and I’d really appreciate some help trying solve it. Thanks.