@intastellar/signin-sdk-react
v1.1.303
Published
Official Intastellar authentication SDK for React applications
Maintainers
Readme
@intastellar/signin-sdk-react
Official Intastellar authentication SDK for React applications.
Installation
npm install @intastellar/signin-sdk-reactUsage
Basic Usage
import { IntastellarButton } from "@intastellar/signin-sdk-react";
function App() {
const handleLogin = (account) => {
console.log("User logged in:", account);
};
return (
<IntastellarButton clientId="your-client-id" loginCallback={handleLogin} />
);
}Using the Hook
import { useIntastellar } from "@intastellar/signin-sdk-react";
function MyComponent() {
const { users, isLoading, signin, logout, isSignedIn } = useIntastellar({
clientId: "your-client-id",
});
return (
<div>
{isSignedIn ? (
<button onClick={logout}>Sign Out</button>
) : (
<button onClick={() => signin()}>Sign In</button>
)}
</div>
);
}Configuration
| Property | Type | Required | Description |
| --------------- | -------- | -------- | --------------------------------------- |
| clientId | string | Yes | Your Intastellar application client ID |
| scopes | string | No | OAuth scopes (default: "profile,email") |
| theme | object | No | Theme configuration |
| loginCallback | function | No | Callback when login succeeds |
| errorCallback | function | No | Callback when login fails |
License
MIT © Intastellar Solutions International
