Skip to main content
import { useState } from 'react';
import { useStytchB2BClient } from '@stytch/react/b2b';

export const GetConnectedApps = () => {
  const stytch = useStytchB2BClient();
  const [connectedApps, setConnectedApps] = useState([]);

  const getConnectedApps = async () => {
    const response = await stytch.organization.getConnectedApps();
    setConnectedApps(response.connected_apps);
  };

  return (
    <div>
      <button onClick={getConnectedApps}>Get Connected Apps</button>
      <ul>
        {connectedApps.map((app) => (
          <li key={app.connected_app_id}>
            <p>App: {app.name}</p>
            <p>Type: {app.client_type}</p>
          </li>
        ))}
      </ul>
    </div>
  );
};
{
  "status_code": 200,
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "connected_apps": [
    {
      "client_type": "first_party",
      "connected_app_id": "connected-app-test-aeadeabc-a3a3-4796-83d0-b757e3001000",
      "name": "first-party-confidential-app",
      "description": "A first party connected app",
      "logo_url": null
    }
  ]
}
The organization.getConnectedApps method wraps the Get Connected Apps API endpoint. The organization_id will be automatically inferred from the logged-in session. This method retrieves a list of Connected Apps that have been installed by the Members. A Connected App can be considered to be installed if at least one of the Organization’s Members has successfully completed an authorization flow with the Connected App and no revocation has occurred since that completion. A Connected App may be uninstalled if the Organization changes its first_party_connected_apps_allowed_type or third_party_connected_apps_allowed_type policies.

Response

connected_apps
array[objects]
An array of Connected Apps which have been installed by an Organization member.
request_id
string
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
status_code
number
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.