I need some help here. I am in a place where I can see the JWT on my Node server from my Vue app and that is working, so I can get some secure routes going, good. Next I need to assign some roles and this is where things get a little confusing for me. I am a newer programmer and came to Auth0 to simplify my authorization and it has been anything but easy. I used Passport before in my Node apps but I wanted to offload the maintenance and security risk. Anyway. My application requires users to pay to use my application and currently they don’t have an easy way to do that, they told me to use rules. So my server will end up taking the payment and then passing the role to Auth0, as I understand it.
I currently have a
/role route going that just sends
paid to the route. So when Auth0 hits that route I can set the role to
paid, then I should be able to access the route.
I added a
Set roles to a user in the Dashboard of Auth0, but I need to make an API call and am pretty confused about how to approach this.
All they show is a single function for me to work in, which wouldn’t be a problem but I don’t know how to make an API call from within the function to my server. I would normally use Axios but I don’t think I can set a dependency. So I need to know how to make the call, is it promise or callback-based?
Also how do I set the role if this stage is completed, is it `user.app_metadata.role’ ? I’m not sure.
Then how do I tell Auth0 what user to set this too? Do I need to pass through the JWT from my server? This is all very confusing to me right now. Auth0 provides documentation but not for a complete use case, I have to piece it together which is not working out so well and the deeper I go the harder it is for me to find examples that work for my use case.