- introspect - Introspect Customer Session
- getAuthenticatedUser - Get Authenticated Portal User
Introspect the current session and return its information.
Scopes: customer_portal:read customer_portal:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.customerSession.introspect({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalCustomerSessionIntrospect } from "@polar-sh/sdk/funcs/customerPortalCustomerSessionIntrospect.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalCustomerSessionIntrospect(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("customerPortalCustomerSessionIntrospect failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
security |
operations.CustomerPortalCustomerSessionIntrospectSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.CustomerCustomerSession>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |
Get information about the currently authenticated portal user.
Scopes: customer_portal:read customer_portal:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.customerSession.getAuthenticatedUser({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalCustomerSessionGetAuthenticatedUser } from "@polar-sh/sdk/funcs/customerPortalCustomerSessionGetAuthenticatedUser.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalCustomerSessionGetAuthenticatedUser(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("customerPortalCustomerSessionGetAuthenticatedUser failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
security |
operations.CustomerPortalCustomerSessionGetAuthenticatedUserSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.PortalAuthenticatedUser>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.SDKError | 4XX, 5XX | */* |