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

Provide AuthToken but still require locationid. #60

Open
digitalepicfury opened this issue Dec 8, 2022 · 0 comments
Open

Provide AuthToken but still require locationid. #60

digitalepicfury opened this issue Dec 8, 2022 · 0 comments

Comments

@digitalepicfury
Copy link

digitalepicfury commented Dec 8, 2022

There should be a better way of setting the locationid. I wouldn't know to set locationid when I don't use the built in oauth functions.

const locationid = 1; // Which translates to "api.pcloud.com"
const client = pcloudSdk.createClient(authToken, 'oauth', locationid);

Sometimes I've got a node server that already has an authentication token and doesn't need to prompt for another authToken.

The error I get is:
ReferenceError: locationid is not defined at ApiMethod

Alternatively I know I can do this:

global.locationid = 1;    
const authToken = await getAuth(); // Calls userinfo   
const client = pcloudSdk.createClient(authToken, 'pcloud', false);

Alternatively, we can provide a way to call userInfo under oAuth by passing the username and password. (With a note to use HTTPS).

The goal is to get the userInfo server side on a java server for instance.

Which does work. I just would rather pass in locationid under ApiMethod or on the client level if possible.

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

1 participant