valapi / node-valapi

Valorant API wrapper for nodejs
https://valapi.github.io
MIT License
18 stars 7 forks source link

Blocked by Cloudflare #9

Closed PabloRNC closed 1 month ago

PabloRNC commented 2 months ago

Description

Hi. I have recently tested this package and I when I tried to login and get my account token Cloudflare was blocking me. I do not know either if is my problem or package one.

Code

import AuthClient from '@valapi/auth';

const auth = new AuthClient();

auth.login('user', 'password').then(console.log);

Error

No response

Platform

Windows 11

Node.js Version

20.15.0

@valapi Version

5.0.0-beta.0

KTNG-3 commented 2 months ago

They update the new method so it gets blocked by Cloudflare, and it should be fixed in 1-2 business days

-- Thanks for the fast reporting

PabloRNC commented 2 months ago

Great. Very appreciated

KTNG-3 commented 1 month ago

Patched. 😊

npmjs: https://www.npmjs.com/package/@valapi/auth/v/5.0.0-beta.1 guide: https://valapi.github.io/guide/packages/auth/token/identity.html

PabloRNC commented 1 month ago

Great

PabloRNC commented 1 month ago

I have tried and I was thrown an error while executing the login function:

captcha_not_allowed

The captcha is generated correctly as I log the response and it seems to be generated without any problem.

KTNG-3 commented 1 month ago

That error only shows up when captcha is not done correctly, especially the captcha solver. or it "just bad luck" sometimes gives that error and try that script again

PabloRNC commented 1 month ago

This is my code. I have tried it in a replit project as now I cannot test if it works locally.


const { Auth } = require("@valapi/auth")

const auth = new Auth();

auth.captcha().then(captcha => {
  auth.login({
    username: "user",
    password: "password",
    captcha
  }).then(token => {
    console.log(token);
  })
})
KTNG-3 commented 1 month ago

if you use typescript It will show that as an error image

please check out the guide

1) https://valapi.github.io/guide/packages/auth/token/captcha.html you will get captchaResponse variable here

2) https://valapi.github.io/guide/packages/auth/token/identity.html and put that like this

{
    username: "Foo".
    password: "Bar",
    captcha: captchaResponse 
}
PabloRNC commented 1 month ago

Now I have used the right captcha response and a 403 error was shown, meaning I was blocked by Cloudflare. The thing is that then I tried with a random string value and I was still blocked so I will try later.

PabloRNC commented 1 month ago

Now it worked thanks.

PabloRNC commented 1 month ago

Only one more question. Tokens expire, aren't they?

If so how can I refresh them only when there are expired?

KTNG-3 commented 1 month ago

This will automatically detect when Token is expired (after first authenticated)

if (!auth.isAuthenticated) {
    await auth.reauthorize();
}

or just

await auth.reauthorize();

https://valapi.github.io/guide/packages/auth/token/cookie.html

PabloRNC commented 1 month ago

All right thanks. May I ask about one unofficial endpoint which is not part of your valorant api lib but you might know?

KTNG-3 commented 1 month ago

Unofficial

Likey Offical

PabloRNC commented 1 month ago

The thing is that I wanted to know whether I can get a match with an user puuid that is not from my user access token

KTNG-3 commented 1 month ago

no. best thing you can do is your friend + don't ask me how

PabloRNC commented 1 month ago

Okey

PabloRNC commented 1 week ago

Hi. I am getting an auth_failure error despite my username and password are correct and I am generating a correct captcha token.