<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
0D50Z00008OMUcQSAXOkta Classic EngineOkta Integration NetworkAnswered2024-03-25T13:11:51.000Z2018-10-01T17:02:32.000Z2018-10-15T19:59:04.000Z

jt3xk (jt3xk) asked a question.

Issue while creating an application through okta api

I followed https://developer.okta.com/docs/api/resources/apps to create an app with following:

 

headers = {

'Accept': 'application/json',

'Authorization': 'SSWS '+api_token,

'Content-Type': 'application/json'

 

}

 

input = {"name": tenant_name, "label": "Sample tenant App", "signOnMode": "OPENID_CONNECT",

}

 

response = requests.post(url, headers=headers, json=input)

 

url: https://dev-231233.oktapreview.com/api/v1/apps (example)

 

 

But I get following error:

 

{'errorCode': 'E0000007', 'errorSummary': 'Not found: Resource not found: test-tenant (App)', 'errorLink': 'E0000007', 'errorId': 'oaedyrTOkwESTSg7_A8nXrCxg', 'errorCauses': []}

 

 

 

I am wondering that i am trying to create an app and this api call is trying to find that app, is anything missing in the request params?

 

I also tried the python SDK https://github.com/okta/okta-sdk-python but I am getting errors wrt python 3.7 . Looks like it is not maintained recently.

 

I would appreciate any help with code samples to create an APP ?


  • Hi Prasad,

     

    When creating an OIDC application through API, you will need to use "oidc_client" for "name" attribute. This is a standard when creating any OIDC application. You can further customize the name by using the "label". Also, you will need to specify the following settings for the application: client_uri, redirect_uri, response_types, grant_types and application_type.

     

    If you are familiar with Postman, you can use the Apps collection available here https://developer.okta.com/reference/postman_collections/. Simply add it to Postman and navigate to Apps (Okta API) >> Add Application >> Add OAuth2 Client App.

     

    Here is also an example in cURL for achieving this result

     

    curl -X POST \

     https://yourOrg.okta.com/api/v1/apps \

     -H 'Accept: application/json' \

     -H 'Authorization: SSWS API_TOKEN' \

     -H 'Content-Type: application/json' \

     -d '{

      "name": "oidc_client",

      "label": "Name of your client here",

      "signOnMode": "OPENID_CONNECT",

      "credentials": {

       "oauthClient": {

        "token_endpoint_auth_method": "client_secret_post"

       }

      },

      "settings": {

       "oauthClient": {

        "client_uri": "http://localhost:8080",

        "logo_uri": "http://developer.okta.com/assets/images/logo-new.png",

        "redirect_uris": [

         "https://example.com/oauth2/callback",

         "myapp://callback"

        ],

        "response_types": [

         "token",

         "id_token",

         "code"

        ],

        "grant_types": [

         "implicit",

         "authorization_code"

        ],

        "application_type": "native"

       }

      }

    }'

     

    If you have any further questions about the implementation, please feel free to open a support ticket with us by sending an email to developers@okta.com.

     

    Thank You,

     

    Dragos Gaftoneanu

    Developer Support Engineer

    Okta Global Customer Care

    Expand Post
    Selected as Best
  • jt3xk (jt3xk)

    {'errorCode': 'E0000001', 'errorSummary': 'Api validation failed: generalSettings', 'errorLink': 'E0000001', 'errorId': 'oae2hOfNjfcTGqUdY1ngXpmLQ', 'errorCauses': [{'errorSummary': 'Cannot create application instance. Maximum number of instances has been reached.'}]}

     

    Above it an error I am getting after putting {"name": "template_basic_auth". However I am able to create an app through GUI but not sure what is the reason of this error while creating the app using APIs

    Expand Post
  • Hi Prasad,

     

    When creating an OIDC application through API, you will need to use "oidc_client" for "name" attribute. This is a standard when creating any OIDC application. You can further customize the name by using the "label". Also, you will need to specify the following settings for the application: client_uri, redirect_uri, response_types, grant_types and application_type.

     

    If you are familiar with Postman, you can use the Apps collection available here https://developer.okta.com/reference/postman_collections/. Simply add it to Postman and navigate to Apps (Okta API) >> Add Application >> Add OAuth2 Client App.

     

    Here is also an example in cURL for achieving this result

     

    curl -X POST \

     https://yourOrg.okta.com/api/v1/apps \

     -H 'Accept: application/json' \

     -H 'Authorization: SSWS API_TOKEN' \

     -H 'Content-Type: application/json' \

     -d '{

      "name": "oidc_client",

      "label": "Name of your client here",

      "signOnMode": "OPENID_CONNECT",

      "credentials": {

       "oauthClient": {

        "token_endpoint_auth_method": "client_secret_post"

       }

      },

      "settings": {

       "oauthClient": {

        "client_uri": "http://localhost:8080",

        "logo_uri": "http://developer.okta.com/assets/images/logo-new.png",

        "redirect_uris": [

         "https://example.com/oauth2/callback",

         "myapp://callback"

        ],

        "response_types": [

         "token",

         "id_token",

         "code"

        ],

        "grant_types": [

         "implicit",

         "authorization_code"

        ],

        "application_type": "native"

       }

      }

    }'

     

    If you have any further questions about the implementation, please feel free to open a support ticket with us by sending an email to developers@okta.com.

     

    Thank You,

     

    Dragos Gaftoneanu

    Developer Support Engineer

    Okta Global Customer Care

    Expand Post
    Selected as Best
  • jt3xk (jt3xk)

    Hi Dragos,

    Thanks for your reply. It worked for me. It was an issue with label and also the URL instance I am hitting. I have 2 dev URLs one with dev-705996 and dev-895265. So the API works fine on 705996 but not on 895265. 

    On 895265, I get an error:

    {'errorCode': 'E0000001', 'errorSummary': 'Api validation failed: generalSettings', 'errorLink': 'E0000001', 'errorId': 'oae2hOfNjfcTGqUdY1ngXpmLQ', 'errorCauses': [{'errorSummary': 'Cannot create application instance. Maximum number of instances has been reached.'}]} ..

    However, I am able to create an app from GUI so not sure of this error coming for 895265.

     

    Thanks,

    Prasad

    Expand Post
This question is closed.
Loading
Issue while creating an application through okta api