
MatthewH.10249 (State of Iowa) asked a question.
I've created a Delegated Workflow that calls the "/api/v1/org/email/bounces/remove-list" API endpoint to help clear bounced or blocked email addresses in Okta. I've been doing this via Postman with no issues so I decided to create a delegated workflow so others like Help Desk staff can take care of these when the pop up.
https://support.okta.com/help/s/article/Troubleshooting-EMail-Deliverability?language=en_US
When I run the Workflow "Okta Custom API Action" card in the Workflow it fails with the following error.
error="insufficient_scope", error_description="The access token provided does not contain the required scopes.", resource="api_v1_org_email_bounces_remove-list""
I know this runs under the context of the "Okta Workflows OAuth (OpenID)" app but I don't know what "scope" to grant to that app in order to get past this issue.
FYI - I am able via a "API Connection Post" card to make the API call successfully but that uses an API Token in the request header. I don't want to use this card because this Workflow will not run that often and thus the API Token will expire and require someone to manually generate a new token and modify the Workflow which is not desirable. I could create some sort of token keep alive but I'm hoping that there will not be necessary.

@MatthewH.10249 (State of Iowa)
So this is a pretty tricky one. Workflows "Okta" connection is not going to support doing this out of the box as it leverages the scope (okta.orgs.manage) and the Okta connection will not request this scope.
Additionally, okta.orgs.manage isn't a scope listed in the Scopes column of Applications.
That being said what you can do is the following which I just got through testing and was successful:
(Note: I only performed this process once so the following instructions might be a tad off but should be mostly accurate)
Create an OIDC Web App:
1) Navigate to Applications > Applications and choose "Create App Integration"
2) Select OIDC > Web Application
3) Leave it as Authorization code & Select Refresh Token
3) Set redirect URI:
https://oauth.workflows.oktapreview.com/oauth/httpfunctions/cb
https://oauth.workflows.okta.com/oauth/httpfunctions/cb
4) Assign your admin to the app (and/or potentially the service account)
Grant the App the scope:
1) Create an API Token
2) Create a API Connector connection (Custom) with header: Authorization value: SSWS <token value>
3) Create a new flow (This is a one time use flow)
4) Add a - Object Construct card and add the following pairs:
scopeId : okta.orgs.manage
issuer : https://<your Okta tenant domain>.okta(preview).com
5) Add a compose card
https://<yourdomain>.okta(preview).com/api/v1/apps/<webAppID>/grants
6) Add an API Connector RAW card
7) Set the Auth to the API Token connection
8) Set the Method to POST
9) Drag the created object in step 4 to the Body
10) Run the flow.
This is going to grant okta.orgs.manage as an allowed scope for the application.
Setup an API Connector Oauth connection:
1) Create a new API connector connection with the type being Oauth
2) Obtain the clientId/Secret from the Web App
3) Set the scope to: offline_access okta.orgs.manage
4) Token/Auth paths by default are:
https://<yourOktaDomain>/oauth2/v1/authorize
https://<yourOktaDomain>/oauth2/v1/token
Since you are logged in it should just leverage your user and automatically consent.
You should now be able to test hitting the email endpoint with the Oauth connection.