Skip to content

Sandbox environment throws invalid_token error #4999

@sriechers

Description

@sriechers

Description

I am trying to use the polar typescript sdk with the sandbox environment. However when initialise the sdk like this

import { env } from '@/env.mjs'
import { Polar } from '@polar-sh/sdk'

export const POLAR_ENV = process.env.NODE_ENV === 'production' ? 'production' : 'sandbox'

export const polar = new Polar({
  accessToken: env.POLAR_ACCESS_TOKEN,
  server: POLAR_ENV,
})

I get the error

Error: API error occurred: Status 401 Content-Type application/json Body 
{"error": "invalid_token", "error_description": "The access token provided is expired, revoked, malformed, or invalid for other reasons."}

I created the POLAR_ACCESS_TOKEN in the live dashboard, because I cannot see an option to generate a sandbox access token in the sandbox dashboard.

Image

These are all the available options in my sandbox account settings page. I've tried creating an OAuth Account but that one didn't work either.

Environment:

  • Operating System: Windows
  • Browser (if applicable): Chrome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions