I have followed the tutorial here:
Getting the access token directly from the API test tab is fine and works, but I am having trouble generating an access token with the correct scope.
Just to confirm the property is “scope” (for API) not “scopes” (which is uses for app JWTs)?
I am using the Jose.Jwt .Net Library library and generating a JWT similar to how I use it for app JWT creation, but changed “scopes” to “scope” and creating the read:messages and create:messages (to work with the example app) as:
var scope = new
{
messages = new
{
actions = new] {"read", "create"}
}
}
The access token created does validate on the api/ping/secure call but on the api/messages there are no scopes coming through?
any pointers?
MORE INFO / UPDATE
Looking at this page:
I can see that the scope needs to be specified as “scope” and is a space delimited string.
Its also indicates that the algorithm needs to be HS256
The API signing algorithm when I created the API in Auth0 defaults to RS256 and the corresponding Client automatically created has an the default OAuth JsonWebToken Signature algorithm set to HS256. Do these need to be the same or changed to make it work?
Leaving the defaults above and creating a JWT access token is still not working? The documtenation is still very hit and miss and only leaves trial and error and a lot of searching of the documentation and going in circles. Surely this is a straight forward one for support to answer? and/or update the tutorial with links to the correct info to create the access token.
…or am I really missing something…
Can I in fact use the Jose.JWT library to create the access token or do I need to call an Auth0 API to do this?
MORE INFO 2
Hi @jerrie ,
The technology is .Net Core 2.
I need customers to signup and register for the service (multi-tenant app).
(I have implemented web app authentication in .Net Core 1.1 for multi-tenancy and somewhat familiar with how that works) So users can signup, login and add additional users to their tenant. This uses a single Auth0 Client (OIDC compliant) with user/app meta data and rules to handles the multi-tenancy etc. [this needs to be upgraded to .net core 2 so I assume this is minimal when I create a new client] This part of the app is essentially the admin interface, the rest of the functionality is via integration.
With this particular app, there are 2 parts that require integration:
-
A Web API (to upload files and add users who have visibility on those files)
This will be used via the customer app. -
A page that provides specific functionality to view these files in a particular way, for specific users This page will be part of our application. (the customer app will open a new window/tab in a browser or create an iFrame within the their application)
The first part is to expose Web API access, accessible from their server, this requires securing and was looking at this example; Auth0 ASP.NET Core Web API SDK Quickstarts: Using your API
Is this correct for server to server communication?
in this case the customer needs to get the access token, how do they get this to then call the api endpoints? What do we need to supply in our admin interface, eg an API key etc?
For the second part of the app, we need to authenticate/authorise users for the iFrame or page that they open within our app, the customer users will login to their app (which can be any technology that we don’t know about), but we need to know who each user is and their permissions, which they will setup via our api.
In this case we assume that the customer app will get an access token via our Web API and pass this to the page which will need to make javascript calls to our server.
(This could be seen as an SPA app or a case for SSO) but the customer users will only login to their app and not have to login to ours? We can build functionality to redirect users back to the customers app if we find them logged out etc, so for instance the customer app would need to generate new tokens/key to re-authenticate etc to pass what they need back to our page?
Does this make sense, I am trying to translate this into Auth0 workflows but can’t map this in my mind, do we need to implement 3 different workflows (admin login, api auth, SPA/page auth)? If you could provide information on how this cold work, that would be greatly appreciated.