import { HonuaClient } from "@honua/sdk-js/honua";
import { oauth2 } from "@honua/sdk-js/auth";
const auth = oauth2({
authorizationEndpoint: "https://idp.example/authorize",
tokenEndpoint: "https://idp.example/token",
clientId: "my-app",
redirectUri: `${location.origin}/callback`,
scopes: ["openid", "profile"],
});
const client = new HonuaClient({ baseUrl: "https://api.example", auth });
// On the callback page:
if (auth.isRedirectCallback()) await auth.handleRedirectCallback();
else if (!(await auth.isSignedIn())) await auth.signIn();
Create an OAuth2 authorization-code + PKCE HonuaAuthProvider.