Skip to content
This repository has been archived by the owner on Sep 8, 2023. It is now read-only.

undefined userData with getUserProfile and undefined userID with getToken #188

Closed
Aerglonus opened this issue Jul 17, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@Aerglonus
Copy link
Contributor

These are two probably related issues.

When running getToken the reponse contains userID as undefined

const renew = await threadsAPI.getToken()
// Response
//  token : the Bearer token
//  userID: undefined

And when using getUserProfile the reponse is userData undefined but investigating the actual response data res.data is returns a web page instead. res.data.data.userData.user and res.data.data.userData returns undefined.

undefined
TypeError: Cannot read properties of undefined (reading 'userData')

Expected response :

@Aerglonus
Copy link
Contributor Author

I got it to work by changing the User-Agent seems to respond with data again instead of the webpage.

from:
'User-Agent': Barcelona ${LATEST_ANDROID_APP_VERSION} Android

to :
'User-Agent': Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.199 Safari/537.36

but its breaking things like authentication, likes, etc. so this probably requires adding a new function like _getDefaultDesktopHeaders and _requestDesktopQuery that are used only on the methods that make requests the https://www.threads.net/api/graphql since it appears that this endpoint is used in browsers or am I wrong?

@junhoyeo
Copy link
Owner

Released v1.5.3

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

No branches or pull requests

2 participants