2

I recently started to work with the roblox api, It's been going good so far but I can't login. I tried to set the cookie by doing apiCall.headers.set-cookie = cookie, But that doesn't seem to work. How can I solve this issue?

Would I have to get set-cookie then edit it? i.g

const cookieSet = await apiCall.headers.get("set-cookie") cookieSet = cookie 

If I made it difficult to understand, I'll try to make it more clear How would I post a cookie to a roblox API?

My code:

 if (!cookie.startsWith("_|WARNING:")) { throw new Error("Make sure your token is correct") } const cookies = { headers: { cookie: cookie } } await fetch("https://www.roblox.com", cookies) const thing = await fetch('https://api.roblox.com/currency/balance', cookies).then(res => res.json()) console.log(thing) 

Thing outputs : { errors: [ { code: 403, message: 'Forbidden' } ] }

4
  • Does this answer your question? How to send cookies with node-fetch? Commented Aug 8, 2020 at 21:08
  • Not really, I still get a 403 error. Commented Aug 8, 2020 at 21:15
  • 1
    What's the purpose of the cookie? Because a 403 would suggest an authorisation problem, meaning you don't have permissions to do what you are trying to do... Commented Aug 8, 2020 at 21:34
  • I'm trying to get the users balance using a roblox API Commented Aug 8, 2020 at 21:37

1 Answer 1

1

Well turns out I had to access the cookie from the Header. I did so by doing

 const apiCall = await html.func("api.roblox.com/currency/balance", { headers: { cookie: `.ROBLOSECURITY=${cookie}` } }) 

Thanks for those who tried to help me!

Sign up to request clarification or add additional context in comments.

2 Comments

Isn't that what the linked answer says?
Well, I didn't realize it until I kept staring at it.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.