I have an internal API used by a UI. I have set up Okta SSO and the users are able to sign in. When they interact with the UI they query the API using their Access Token and they are able to retrieve data. I have a service that uses some of the same end points that is now not authenticated with the API. I set up a Client Credentials workflow so it it able to get a bearer token but the API won’t authorize it. I have set up the Okta Middleware like this:
builder.Services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = OktaDefaults.ApiAuthenticationScheme;
options.DefaultChallengeScheme = OktaDefaults.ApiAuthenticationScheme;
options.DefaultSignInScheme = OktaDefaults.ApiAuthenticationScheme;
})
.AddOktaWebApi(new OktaWebApiOptions()
{
OktaDomain = {{ my domain }},
AuthorizationServerId = {{ my server }},
Audience = {{ audience }}
});
The client credentials have the same domain and auth server but a different audience. When I switch the audience to the new one, the client credentials work and the API authorizes the query, but then the UI no longer works. Is it possible to somehow add both audiences? Or multiple OktaWebApi options?