OpenID Connect
Authorize
GET
/
v1
/
oauth2
/
authorize
Go (SDK)
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"log"
"github.com/polarsource/polar-go/models/operations"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Oauth2.Authorize(ctx)
if err != nil {
log.Fatal(err)
}
if res.ResponseOauth2Authorize != nil {
switch res.ResponseOauth2Authorize.Type {
case operations.Oauth2AuthorizeResponseOauth2AuthorizeTypeUser:
// res.ResponseOauth2Authorize.AuthorizeResponseUser is populated
case operations.Oauth2AuthorizeResponseOauth2AuthorizeTypeOrganization:
// res.ResponseOauth2Authorize.AuthorizeResponseOrganization is populated
}
}
}from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.oauth2.authorize()
# Handle response
print(res)import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.oauth2.authorize();
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->oauth2->authorize(
);
if ($response->responseOauth2Authorize !== null) {
// handle response
}curl --request GET \
--url https://api.polar.sh/v1/oauth2/authorize \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/oauth2/authorize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.polar.sh/v1/oauth2/authorize")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/oauth2/authorize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"client": {
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"client_id": "<string>",
"client_name": "<string>",
"client_uri": "<string>",
"logo_uri": "<string>",
"tos_uri": "<string>",
"policy_uri": "<string>"
},
"sub_type": "<string>",
"sub": {
"id": "<string>",
"email": "jsmith@example.com",
"avatar_url": "<string>"
},
"scopes": [],
"scope_display_names": {
"openid": "OpenID",
"profile": "Read your profile",
"email": "Read your email address",
"user:read": "Read your user account",
"user:write": "Manage your user account",
"organizations:read": "Read your organizations",
"organizations:write": "Create or modify organizations",
"custom_fields:read": "Read custom fields",
"custom_fields:write": "Create or modify custom fields",
"discounts:read": "Read discounts",
"discounts:write": "Create or modify discounts",
"checkout_links:read": "Read checkout links",
"checkout_links:write": "Create or modify checkout links",
"checkouts:read": "Read checkout sessions",
"checkouts:write": "Create or modify checkout sessions",
"transactions:read": "Read transactions",
"transactions:write": "Create or modify transactions",
"payouts:read": "Read payouts",
"payouts:write": "Create or modify payouts",
"products:read": "Read products",
"products:write": "Create or modify products",
"benefits:read": "Read benefits",
"benefits:write": "Create or modify benefits",
"events:read": "Read events",
"events:write": "Create events",
"meters:read": "Read meters",
"meters:write": "Create or modify meters",
"files:read": "Read file uploads",
"files:write": "Create or modify file uploads",
"subscriptions:read": "Read subscriptions made on your organizations",
"subscriptions:write": "Create or modify subscriptions made on your organizations",
"customers:read": "Read customers",
"customers:write": "Create or modify customers",
"members:read": "Read members",
"members:write": "Create or modify members",
"wallets:read": "Read wallets",
"wallets:write": "Create or modify wallets",
"disputes:read": "Read disputes",
"customer_meters:read": "Read customer meters",
"customer_sessions:write": "Create or modify customer sessions",
"member_sessions:write": "Create or modify member sessions",
"customer_seats:read": "Read customer seats",
"customer_seats:write": "Create or modify customer seats",
"orders:read": "Read orders made on your organizations",
"orders:write": "Modify orders made on your organizations",
"refunds:read": "Read refunds made on your organizations",
"refunds:write": "Create or modify refunds",
"payments:read": "Read payments made on your organizations",
"metrics:read": "Read metrics",
"metrics:write": "Create or modify metric definitions",
"webhooks:read": "Read webhooks",
"webhooks:write": "Create or modify webhooks",
"license_keys:read": "Read license keys",
"license_keys:write": "Modify license keys",
"customer_portal:read": "Read your orders, subscriptions and benefits",
"customer_portal:write": "Create or modify your orders, subscriptions and benefits",
"notifications:read": "Read notifications",
"notifications:write": "Mark notifications as read",
"notification_recipients:read": "Read notification recipients",
"notification_recipients:write": "Create or modify notification recipients",
"organization_access_tokens:read": "Read organization access tokens",
"organization_access_tokens:write": "Create or modify organization access tokens"
}
}Authorizations
You can generate an Organization Access Token from your organization's settings.
Response
200 - application/json
Successful Response
- AuthorizeResponseUser
- AuthorizeResponseOrganization
Show child attributes
Show child attributes
Allowed value:
"user"Show child attributes
Show child attributes
Available options:
openid, profile, email, user:read, user:write, organizations:read, organizations:write, custom_fields:read, custom_fields:write, discounts:read, discounts:write, checkout_links:read, checkout_links:write, checkouts:read, checkouts:write, transactions:read, transactions:write, payouts:read, payouts:write, products:read, products:write, benefits:read, benefits:write, events:read, events:write, meters:read, meters:write, files:read, files:write, subscriptions:read, subscriptions:write, customers:read, customers:write, members:read, members:write, wallets:read, wallets:write, disputes:read, customer_meters:read, customer_sessions:write, member_sessions:write, customer_seats:read, customer_seats:write, orders:read, orders:write, refunds:read, refunds:write, payments:read, metrics:read, metrics:write, webhooks:read, webhooks:write, license_keys:read, license_keys:write, customer_portal:read, customer_portal:write, notifications:read, notifications:write, notification_recipients:read, notification_recipients:write, organization_access_tokens:read, organization_access_tokens:write Show child attributes
Show child attributes
Was this page helpful?
⌘I
Go (SDK)
package main
import(
"context"
"os"
polargo "github.com/polarsource/polar-go"
"log"
"github.com/polarsource/polar-go/models/operations"
)
func main() {
ctx := context.Background()
s := polargo.New(
polargo.WithSecurity(os.Getenv("POLAR_ACCESS_TOKEN")),
)
res, err := s.Oauth2.Authorize(ctx)
if err != nil {
log.Fatal(err)
}
if res.ResponseOauth2Authorize != nil {
switch res.ResponseOauth2Authorize.Type {
case operations.Oauth2AuthorizeResponseOauth2AuthorizeTypeUser:
// res.ResponseOauth2Authorize.AuthorizeResponseUser is populated
case operations.Oauth2AuthorizeResponseOauth2AuthorizeTypeOrganization:
// res.ResponseOauth2Authorize.AuthorizeResponseOrganization is populated
}
}
}from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.oauth2.authorize()
# Handle response
print(res)import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.oauth2.authorize();
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$sdk = Polar\Polar::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->oauth2->authorize(
);
if ($response->responseOauth2Authorize !== null) {
// handle response
}curl --request GET \
--url https://api.polar.sh/v1/oauth2/authorize \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/oauth2/authorize', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.polar.sh/v1/oauth2/authorize")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/oauth2/authorize")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"client": {
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"client_id": "<string>",
"client_name": "<string>",
"client_uri": "<string>",
"logo_uri": "<string>",
"tos_uri": "<string>",
"policy_uri": "<string>"
},
"sub_type": "<string>",
"sub": {
"id": "<string>",
"email": "jsmith@example.com",
"avatar_url": "<string>"
},
"scopes": [],
"scope_display_names": {
"openid": "OpenID",
"profile": "Read your profile",
"email": "Read your email address",
"user:read": "Read your user account",
"user:write": "Manage your user account",
"organizations:read": "Read your organizations",
"organizations:write": "Create or modify organizations",
"custom_fields:read": "Read custom fields",
"custom_fields:write": "Create or modify custom fields",
"discounts:read": "Read discounts",
"discounts:write": "Create or modify discounts",
"checkout_links:read": "Read checkout links",
"checkout_links:write": "Create or modify checkout links",
"checkouts:read": "Read checkout sessions",
"checkouts:write": "Create or modify checkout sessions",
"transactions:read": "Read transactions",
"transactions:write": "Create or modify transactions",
"payouts:read": "Read payouts",
"payouts:write": "Create or modify payouts",
"products:read": "Read products",
"products:write": "Create or modify products",
"benefits:read": "Read benefits",
"benefits:write": "Create or modify benefits",
"events:read": "Read events",
"events:write": "Create events",
"meters:read": "Read meters",
"meters:write": "Create or modify meters",
"files:read": "Read file uploads",
"files:write": "Create or modify file uploads",
"subscriptions:read": "Read subscriptions made on your organizations",
"subscriptions:write": "Create or modify subscriptions made on your organizations",
"customers:read": "Read customers",
"customers:write": "Create or modify customers",
"members:read": "Read members",
"members:write": "Create or modify members",
"wallets:read": "Read wallets",
"wallets:write": "Create or modify wallets",
"disputes:read": "Read disputes",
"customer_meters:read": "Read customer meters",
"customer_sessions:write": "Create or modify customer sessions",
"member_sessions:write": "Create or modify member sessions",
"customer_seats:read": "Read customer seats",
"customer_seats:write": "Create or modify customer seats",
"orders:read": "Read orders made on your organizations",
"orders:write": "Modify orders made on your organizations",
"refunds:read": "Read refunds made on your organizations",
"refunds:write": "Create or modify refunds",
"payments:read": "Read payments made on your organizations",
"metrics:read": "Read metrics",
"metrics:write": "Create or modify metric definitions",
"webhooks:read": "Read webhooks",
"webhooks:write": "Create or modify webhooks",
"license_keys:read": "Read license keys",
"license_keys:write": "Modify license keys",
"customer_portal:read": "Read your orders, subscriptions and benefits",
"customer_portal:write": "Create or modify your orders, subscriptions and benefits",
"notifications:read": "Read notifications",
"notifications:write": "Mark notifications as read",
"notification_recipients:read": "Read notification recipients",
"notification_recipients:write": "Create or modify notification recipients",
"organization_access_tokens:read": "Read organization access tokens",
"organization_access_tokens:write": "Create or modify organization access tokens"
}
}
