Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of making arbitrary API calls #76

Open
nbarbettini opened this issue Sep 25, 2018 · 2 comments
Open

Example of making arbitrary API calls #76

nbarbettini opened this issue Sep 25, 2018 · 2 comments

Comments

@nbarbettini
Copy link

We should add an example to the readme that demonstrates how to use this client to make arbitrary calls to the Okta API (i.e. endpoints that are not yet officially supported by the library).

For reference, see the SDK readme template here: https://gist.github.com/nbarbettini/c0f44cf08b6d99b39cd59e533842a684#call-other-api-endpoints

@sbauch
Copy link

sbauch commented Feb 8, 2020

this would be super helpful!

I'm currently using Axios to make a request to GET /api/v1/apps/${applicationId}/sso/saml/metadata after adding a custom SAML application.

https://developer.okta.com/docs/reference/api/apps/#preview-saml-metadata-for-application

How could I rewrite this using the client?

  async fetchSamlMetadata(application: any): Promise<string> {
    const kid = application.credentials?.signing?.kid;

    const { data: samlMetadata } = await Axios.get(
      `${process.env.OKTA_CLIENT_ORGURL}api/v1/apps/${application.id}/sso/saml/metadata`,
      {
        params: {
          kid,
        },
        headers: {
          'Accept': 'application/xml',
          'Content-Type': 'application/json',
          'Authorization': `SSWS ${process.env.OKTA_CLIENT_TOKEN}`,
        },
      },
    );

    return samlMetadata;
  }

Having the endpoint supported in the library would be great too, but I'm not so sure how to make the arbitrary request

@bretterer
Copy link
Collaborator

@sbauch Thank you for you feedback! We are in the process of revisiting all of our readme's and will make sure to include something like this in a future release. Our SDK team will make sure that we allow for arbitrary calls to our API that automatically includes all necessary headers

Internal ref: OKTA-278073

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants