mukaschultze / unity-asset-store-api

API Client for Unity's Asset Store
https://www.npmjs.com/package/unity-asset-store-api
MIT License
26 stars 3 forks source link

Invoice Rejected #1

Open vncastanheira opened 4 years ago

vncastanheira commented 4 years ago

I'm having a little trouble verifying the invoice. The token and the publisher ID were supplied as described:

const unityToken = process.env.UNITY_TOKEN //from kharma_session
const publisherID = process.env.PUBLISHER_ID // from the publisher public profile
const storeClient = new AssetStoreClient(unityToken, publisherID, {
    timeout: 60000
});

But after calling:

storeClient.verifyInvoice(invoice)
                .then(() => message.channel.send('Invoice verified with success!'))
                .catch(reason => {
                    message.channel.send('Invalid code.')
                    console.log(`Invoice Rejected: ${reason}`)
                })

it gives me the following message:

Invoice Rejected: StatusCodeError: 401 - "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>401 Authorization Required</title>\n</head><body>\n<h1>Authorization Required</h1>\n<p>This server could not verify that you\nare authorized to access the document\nrequested. Either you supplied the wrong\ncredentials (e.g., bad password), or your\nbrowser doesn't understand how to supply\nthe credentials required.</p>\n</body></html>\n"

The invoice is also a valid code since I have checked on the publisher page.

Using Node 14.3.0 with Windows 10.

mukaschultze commented 4 years ago

I'll be taking a look at that, as for now, I recommend using the official API for invoice validation, it's a safer and more reliable API.

EDIT: Are the other methods working fine?

vncastanheira commented 4 years ago

I'll be taking a look at that, as for now, I recommend using the official API for invoice validation, it's a safer and more reliable API.

EDIT: Are the other methods working fine?

Alright, I went and use their API. But I haven't actually tested the other methods, that was mostly what I was looking for.