<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z0000AFscpaCQBOkta Classic EngineAPI Access ManagementAnswered2024-10-09T14:29:59.000Z2024-10-08T09:15:52.000Z2024-10-09T14:29:59.000Z
Okta API - 403 error code for bearer token generated with correct scope - Okta.NET SDK

We have an app service with private/public key credentials for authentication. We initialize an

OAuthApi with the following configuration :

var privateKey = File.ReadAllText(“privatekey.json”);

var config = new Configuration

{

OktaDomain = “https:devoktainstance.okta.com”,

AuthorizationMode = AuthorizationMode.PrivateKey,

ClientId = “clientIdreplaced”,

Scopes = [“okta.apps.manage”],

PrivateKey = new JsonWebKeyConfiguration(privateKey),

};

var oAuthApi = new OAuthApi(config);

var accessToken = await oAuthApi.GetBearerTokenAsync(); // we receive what it seems to be a valid token with correct scope granted.

We get accessToken back with correct claim for scopes:

“scp”: [

“okta.apps.manage”

]

However when trying to send a request to

{{url}}/api/v1/apps/{{applicationId}}/credentials/jwks

To add a new JWKs key in order to have and facilitate key rotation we received a 403 error:

{

“errorCode”: “E0000006”,

“errorSummary”: “You do not have permission to perform the requested action”,

“errorLink”: “E0000006”,

“errorId”: “oaeiShl7lazQcCxeUc2tLIIsg”,

“errorCauses”: 

}

Even though as per documentation okta.apps.manage scope is granted in the application and set on token.

Documentation link : Add Json Web Key

We are considering the 2nd possibility to do key-rotation by providing an api/url to Okta for fetching dynamically the keys but we`re not comfortable with having an public api exposing this without an extra security/auth method for it.

Also Super Administrator is set in Admin roles.

What can we do and what are we missing here ?


This question is closed.
Loading
Okta API - 403 error code for bearer token generated with correct scope - Okta.NET SDK