Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProductsController unauthorized #5

Open
stursby opened this issue Jan 4, 2025 · 2 comments
Open

ProductsController unauthorized #5

stursby opened this issue Jan 4, 2025 · 2 comments

Comments

@stursby
Copy link
Contributor

stursby commented Jan 4, 2025

I cloned the repo and noticed the ProductsController doesn't work as is since it doesn't look like the API key is being passed anywhere...

ie:

$data = Http::get('https://sandbox-api.polar.sh/v1/products', [
    'organization_id' => env('POLAR_ORGANIZATION_ID'),
    'is_archived' => false,
]);

If I dd($data); I see the following:

image

However, looks like if I just include that API key, it works!

$data = Http::withToken(env('POLAR_API_KEY'))->get('https://sandbox-api.polar.sh/v1/products', [
    'organization_id' => env('POLAR_ORGANIZATION_ID'),
    'is_archived' => false,
]);

Now, if I dd($data->json());, I can see the products!

image

Happy to make a PR too, if you think this looks good!

@emilwidlund
Copy link
Member

@stursby Ah, that definitely looks like a mistake on our end.

Feel free to do a PR! ☺️

@stursby
Copy link
Contributor Author

stursby commented Jan 4, 2025

@emilwidlund done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants