@whop-apps/oauth v0.0.1-canary.109
Whop OAuth Package
This package is designed to allow Whop Apps to interact with the Whop OAuth component that lives at https://oauth.api.whop.com
. It exports both helper functions and an API wrapper to make calls to the REST API.
Usage
Usage from React
"use client";
import { initOauth } from "@whop-apps/sdk";
export const Component = () => {
const handleGoogleLogin = useCallback(() => {
initOAuth({
provider: "google",
scope: "profile email openid",
restPath: "/oauth_callback",
});
}, []);
return (
<div>
<button onClick={handleGoogleLogin}>Login</button>
</div>
);
}
Usage from the server
import { OAuthApi } from "@whop-apps/sdk";
// Retrieve an access token based on a profile ID and user ID
const accessToken = await OAuthApi({ mode: "server" }).retrieveToken({
profile_id: "google_xxxxxxxxx",
provider: "google",
user_id: "user_xxxxxxxxx",
}).then((t) => t.access_token);
// Upload your credentials to the Whop OAuth API
await OAuthApi({ mode: "server" }).createCredentials({
client_id: "YOUR_CLIENT_ID_HERE",
client_secret: "YOUR_CLIENT_SECRET_HERE",
provider: "google"
});
// List all profiles the user has for a specific platform
const profiles = await OAuthApi({ mode: "server" }).listProfiles({
provider: "google",
user_id: "user_xxxxxxxxx",
});
7 months ago
9 months ago
9 months ago
9 months ago
11 months ago
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago