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

Invalid baseUrl #198

Closed
tianBreznik opened this issue Sep 10, 2023 · 8 comments
Closed

Invalid baseUrl #198

tianBreznik opened this issue Sep 10, 2023 · 8 comments

Comments

@tianBreznik
Copy link

I create the client with only the consumer_key and consumer_secret fields filled out and the tokens left out, as I don't need them and I get the type error "Invalid baseUrl option provided." - I can't seem to find anything about this issue documented anywhere. Could someone point me in the direction of quickly resolving this ?

@sirreal
Copy link
Member

sirreal commented Sep 11, 2023

Will you provide a minimal test example of what you're trying to do? For example:

node -e "new (require('tumblr.js').Client)({consumer_key: 'foo', consumer_secret: 'bar'})"

TypeError: Provide consumer_key or all oauth credentials. Invalid token provided.

As I understand, you should be providing either a consumer_key by itself (some endpoints allow "api_key" authentication, which will be used if there's only a consumer_key provided), or all oauth1 credentials: consumer_key, consumer_secret, token, and token_secret:

node -e "new (require('tumblr.js').Client)({consumer_key: 'foo', consumer_secret: 'bar', token: 'baz', token_secret: 'quux'})"

I'm surprised you're seeing anything about baseUrl if you're not providing that option. Will you provide details about your environment? Node version, etc.

@tianBreznik
Copy link
Author

my node version is v14.15.4. I plan to scrape some general posts based on a tag from Tumblr at some point, but for now I'm just trying to set up and connect. I run the same few lines as you quote with consumer key and secret provided, from the browser, and I as such receive the baseUrl error.

When I run the node code from the terminal, I get the following error:Screenshot 2023-09-11 at 14 55 16
The error is thrown from tumblr.js, is this a dependency issue?

@tianBreznik
Copy link
Author

I should also mention, that I am working in ES6, so I am importing the module, not requiring it. Could this somehow cause the baseUrl error?

@sirreal
Copy link
Member

sirreal commented Sep 11, 2023

The library doesn't officially support Node 14. Node 14's end-of-life was 2023-04-30. I'll close this because it seems to be due to an unsupported Node version.

While we don't support Node 14, I will say that 14.15.4 is an old release within the 14 line, the latest being 14.21.3. With 14.21.3 I don't see any issues with the same test code I shared above. If you can't upgrade to a supported Node version, maybe at least getting onto a more recent v14 release would help.

I am importing the module, not requiring it.

That shouldn't be an issue, the integration tests are ES modules and don't have any issues:

import { Client } from 'tumblr.js';

@sirreal sirreal closed this as completed Sep 11, 2023
@tianBreznik
Copy link
Author

Hi! I updated to node 18 and the invalid baseUrl error persists in the browser, whereas when running the code you provided with my consumer key and secret the error becomes that of authentication:
TypeError: Provide consumer_key or all oauth credentials. Invalid token provided.

@sirreal
Copy link
Member

sirreal commented Sep 11, 2023

It sounds like it's working correctly in Node 18. You'll either need to provide only the consumer_key, or all four of the required oauth credentials (consumer_key, consumer_secret, token, and token_secret). You should be able to get that information from https://www.tumblr.com/oauth/apps or https://api.tumblr.com/console/calls/user/info.


As mentioned in the README, this library isn't intended for in-browser use. That's something we could work on, however, if folks are interested. If you are interested, please open a new issue for that and we can consider it and start to understand the demand for that.

@tianBreznik
Copy link
Author

Hi! I tried my consumer_key and secret on the api console, and it looks like the credentials are invalid, since I receive a bad request error, but I'm puzzled as to why. Is my application not registered or is has it not been processed?
Screenshot 2023-09-15 at 16 26 23
I think my application clearly is registered, but something else is going on. Could I contact someone from support to check?

@sirreal
Copy link
Member

sirreal commented Sep 18, 2023

That may be a good place to start, you can contact Tumblr support through the help page: https://help.tumblr.com/hc/en-us

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