GCN-A-fe95cf8c11ae
GCN-A-fe95cf8c11ae: Unable to start GoCloudNative.Bff. Invalid audience. Configure the audience in the appsettings.json or program.cs file and try again.
The GoCloudNative BFF is an authentication gateway. As a result, you must configure an identity provider (correctly) for it to start.
To bootstrap the BFF, load the identity provider configuration from the appsettings.json
:
//...
var builder = WebApplication.CreateBuilder(args);
var config = builder.Configuration.GetSection("Auth0");
builder.Services.AddSecurityBff(o =>
{
o.ConfigureAuth0(config);
//...
});
In order to get an access token with a payload, you need to provide a value for audience
.
How to reproduce this error
To reproduce the error, the Audience
needs to be missing:
"Auth0": {
"ClientId": "{yourClientId}",
"ClientSecret": "{yourClientSecret}",
"Domain": "{yourDomain}",
"Scopes": [
"openid", "profile", "offline_access"
]
},
Or empty
"Auth0": {
...
"Audience": "",
...
},
Or misspelled
"Auth0": {
...
"Audienc": "{yourDomain}",
...
},
Solution
Configure the domain correctly:
"Auth0": {
...
"Audience": "https://www.mydomain.com/api/test",
...
},
To find the correct value for audience
- Go to https://manage.auth0.com
- Under
Applications
, in the menu on the left, clickAPIs
- Select your API or create one
- Next, you’ll see the following screen:
- Copy the
Identifier
to appsettings.json