baileyherbert / envato.js Goto Github PK
View Code? Open in Web Editor NEW๐ Library for working with the Envato API.
Home Page: https://npmjs.com/envato
License: MIT License
๐ Library for working with the Envato API.
Home Page: https://npmjs.com/envato
License: MIT License
When checking the network tab and viewing details I can see this info:
GET /v3/market/buyer/purchase?code=PURCHASE-CODE HTTP/2
Host: api.envato.com
User-Agent: Envato.js (https://github.com/baileyherbert/envato.js)
Referer: http://localhost/
authorization: Bearer MY-TOKEN-HERE
x-client: envato.js
Origin: http://localhost
as you can see the authorization part includes my API token MY-TOKEN-HERE
, is this safe to expose it like this?
Hello Bailey!
I've got the error when using OAuth:
Authentication failed: OAuthError: Received an HTTP error
at OAuth.<anonymous> (.../node_modules/envato/dist/clients/oauth.js:51:23)
at Generator.next (<anonymous>)
at fulfilled (.../node_modules/envato/dist/clients/oauth.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
http: BadRequestError: Bad Request
at HttpClient._getHttpError (.../node_modules/envato/dist/helpers/http.js:111:30)
at HttpClient.<anonymous> (.../node_modules/envato/dist/helpers/http.js:43:29)
at Generator.next (<anonymous>)
at fulfilled (.../node_modules/envato/dist/helpers/http.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 400,
response: {
error: 'invalid_request',
error_description: 'No authorization header passed'
}
}
}
Issue coming from line:
const client = await oauth.getClient(code);
from your example:
// This is an example express route to handle the request
app.get('/authenticate', async function(req, res) {
try {
// Fetch the code from the URL
const code = req.query.code;
// Authenticate the user via the API
const client = await oauth.getClient(code);
const username = await client.private.getUsername();
// You can also get their User ID for data storage
const { userId } = await client.getIdentity();
res.send(`Hello, ${username}!`);
}
catch (error) {
console.error('Authentication failed:', error);
res.status(500).send('Something broke! Try again.');
}
});
My suggestion, how to fix it in attach:
Fix_for_OAuth_authorization_flow.patch.zip
Thanks in advance.
Client.private.getSale
โ If the code is incorrectly formatted, the API now returns an HTTP 422 error. It should catch the error and return undefined
in this case, or better yet, check that the code is valid before sending it to the API.
HttpError: Unknown error
at Client.handleResponse (C:\Users\Bailey\Downloads\envato-test\node_modules\envato\dist\client.js:188:40)
at Request._callback (C:\Users\Bailey\Downloads\envato-test\node_modules\envato\dist\client.js:162:22)
at Request.self.callback (C:\Users\Bailey\Downloads\envato-test\node_modules\request\request.js:185:22)
at Request.emit (events.js:315:20)
at Request.<anonymous> (C:\Users\Bailey\Downloads\envato-test\node_modules\request\request.js:1154:10)
at Request.emit (events.js:315:20)
at IncomingMessage.<anonymous> (C:\Users\Bailey\Downloads\envato-test\node_modules\request\request.js:1076:12)
at Object.onceWrapper (events.js:421:28)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1221:12) {
code: 422,
response: {
error: 422,
description: 'Purchase code provided with an invalid format'
}
}
Hi ๐, thanks for the great lib!
It seems that I get an array of ItemConversation
instead of ItemComment
on a search comments response.
https://github.com/baileyherbert/envato.js/blob/master/src/endpoints/catalog.ts#L190
Hi ๐, thanks for the great lib!
Could you release subj method which described on https://build.envato.com/api/#search_getSearchMoreLikeThis ?
It looks that it should be simple. ;)
Or maybe i'll make update for you review?
Thanks in advance.
Hi! ๐
Firstly, thanks for your work on this project! ๐
Today I used patch-package to patch [email protected]
for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/envato/dist/types/api.d.ts b/node_modules/envato/dist/types/api.d.ts
index b63775a..bc46f13 100644
--- a/node_modules/envato/dist/types/api.d.ts
+++ b/node_modules/envato/dist/types/api.d.ts
@@ -68,6 +68,12 @@ export interface Item {
version: string;
description: string;
};
+ wordpress_plugin_metadata:{
+ plugin_name: string;
+ author_name: string;
+ version: string;
+ description: string;
+ },
rating: number;
rating_count: number;
published_at: Date;
@@ -115,6 +121,7 @@ export interface Item {
};
live_site?: {
url: string;
+ href:string
};
icon_preview?: {
icon_url: string;
This issue body was partially generated by patch-package.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.