Okta

From G1Joshi/Agent-Skills · View interactive version

Okta is an AI agent skill from the GitHub repository G1Joshi/Agent-Skills. Expert Okta identity cloud assistance covering workforce identity, customer identity (CIAM), SAML, and API authorization servers. Use when configuring Okta SSO, managing enterprise directories, or securing APIs.

How to use this skill

Skill file

Okta

Okta is the enterprise standard for Identity and Access Management (IAM). While Auth0 (owned by Okta) targets developers/B2C, "Okta Workforce Identity" targets employee access and large B2B integrations.

When to Use

Quick Start

npm install @okta/okta-react @okta/okta-auth-js
import { Security, LoginCallback } from "@okta/okta-react";
import { OktaAuth } from "@okta/okta-auth-js";

const oktaAuth = new OktaAuth({
  issuer: "https://{yourOktaDomain}/oauth2/default",
  clientId: "{clientId}",
  redirectUri: window.location.origin + "/login/callback",
});

function App() {
  return (
    <Security oktaAuth={oktaAuth}>
      <Route path="/login/callback" component={LoginCallback} />
      <SecureRoute path="/protected" component={MyProtectedPage} />
    </Security>
  );
}

Core Concepts

Okta Application Models & Sign-On Policies

Applications in Okta represent integration targets with distinct security policies:

[ User Directory (Okta Universal Directory) ]
        ├── [ App: AWS IAM Federation (SAML 2.0) ]
        ├── [ App: Internal Engineering Portal (OIDC + PKCE) ]
        └── [ App: Salesforce (SAML + SCIM Provisioning) ]

Okta JWT Token Verification via Okta JWT Verifier

Validates tokens issued by Okta Authorization Servers:

import OktaJwtVerifier from "@okta/jwt-verifier";

const oktaJwtVerifier = new OktaJwtVerifier({
  issuer: "https://my-company.okta.com/oauth2/default",
  clientId: "0oa1234567890abcdef",
  assertClaims: {
    "groups.includes": "Engineering",
  },
});

export async function verifyOktaToken(authHeader: string) {
  const token = authHeader.replace("Bearer ", "");
  const jwt = await oktaJwtVerifier.verifyAccessToken(token, "api://default");
  return jwt.claims;
}

SCIM 2.0 Automated User Provisioning

Synchronizes user creation, updates, and deprovisioning from Okta to downstream apps automatically:

POST /scim/v2/Users HTTP/1.1
Host: api.mysaas.com
Authorization: Bearer <scim_token>
Content-Type: application/scim+json

{
  "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
  "userName": "alice@company.com",
  "name": { "givenName": "Alice", "familyName": "Smith" },
  "active": true
}

Common Patterns

Custom Authorization Server Policy and Scope Enforcement

Problem: Multi-tenant APIs require restricting token issuance to specific organizational scopes and claims.

Solution:

Validate custom Okta scopes on inbound API requests:

import { OktaJwtVerifier } from "@okta/jwt-verifier";

const oktaJwtVerifier = new OktaJwtVerifier({
  issuer: "https://mycompany.okta.com/oauth2/default",
  assertClaims: {
    aud: "api://default",
    cid: process.env.OKTA_CLIENT_ID,
  },
});

export async function verifyOktaScope(token: string, requiredScope: string) {
  const jwt = await oktaJwtVerifier.verifyAccessToken(token, "api://default");
  if (!jwt.claims.scp || !jwt.claims.scp.includes(requiredScope)) {
    throw new Error("Insufficient scope privileges");
  }
  return jwt;
}

Best Practices

Do:

Don't:

Troubleshooting

| Error | Cause | Solution |

| :-------------- | :------------------------- | :------------------------------------------------------------- |

| 403 Forbidden | User not appointed to App. | Assign the User or Group to the Application in Okta Console. |

| Clock Skew | Server time mismatch. | Ensure servers utilize NTP; JWT validation allows ~2 min skew. |

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.