I have successfully created an Angular SPA which communicates with a REST backed. For this backend, I created Permission (aka Scopes) like “read:persons”, “edit:persons” ect.
I also created a small C# program for which I like to do some testing with the REST backend. So I copied code from the auth0 ‘Test’ tab of my API application to get a token. This generates the following code for me:
var client = new RestClient("https://dev-<my auth0-url>.com/oauth/token");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"client_id\":\"<my-auth0-id>\",\"client_secret\":\"<my-auth-secret>\",\"audience\":\"<my-auth0-audience>\",\"grant_type\":\"client_credentials\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Now, when I embed this code into my console application the scopes are missing from this token. It is not clear how to add these to the token, I tried adding something like:
\"scope\":\"read:persons\"
but this fails.
How can I add the scope?