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

Blocked by Cloudflare #9

Closed
PabloRNC opened this issue Jul 31, 2024 · 18 comments
Closed

Blocked by Cloudflare #9

PabloRNC opened this issue Jul 31, 2024 · 18 comments
Assignees
Labels
bug Something isn't working

Comments

@PabloRNC
Copy link

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

@PabloRNC PabloRNC added the bug Something isn't working label Jul 31, 2024
@KTNG-3
Copy link
Member

KTNG-3 commented Aug 2, 2024

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

@KTNG-3 KTNG-3 pinned this issue Aug 2, 2024
@PabloRNC
Copy link
Author

PabloRNC commented Aug 2, 2024

Great. Very appreciated

@KTNG-3
Copy link
Member

KTNG-3 commented Aug 9, 2024

@KTNG-3 KTNG-3 closed this as completed Aug 9, 2024
@PabloRNC
Copy link
Author

PabloRNC commented Aug 9, 2024

Great

@PabloRNC
Copy link
Author

PabloRNC commented Aug 9, 2024

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
Copy link
Member

KTNG-3 commented Aug 9, 2024

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
Copy link
Author

PabloRNC commented Aug 9, 2024

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
Copy link
Member

KTNG-3 commented Aug 10, 2024

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
Copy link
Author

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
Copy link
Author

Now it worked thanks.

@PabloRNC
Copy link
Author

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

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

@KTNG-3
Copy link
Member

KTNG-3 commented Aug 10, 2024

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
Copy link
Author

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

@PabloRNC
Copy link
Author

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
Copy link
Member

KTNG-3 commented Aug 11, 2024

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

@PabloRNC
Copy link
Author

Okey

@PabloRNC
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants