I need help with gql

how do i get a person’s data like username, id, roles, bio, pfp, teams, and acc url when they login with replit auth in python?

1 Like

You don’t need GraphQL for any of this, check out the ‘Authentication’ tab in the Dock in your Repl (I’m not sure if it’s only visible in explorer mode or not), it should provide the information you need.

2 Likes

Most of that you can get with replit auth already so GQL isn’t really needed. But if you want to use the GraphQL, the queries are username, id, roles, bio, image, teams (though i’m pretty sure you can’t get it without the user token but you can however get it with repl auth), and url respectively. Most of these however are accessible through the standard Repl Auth API. To access this information using the gql api, send a post request to https://replit.com/graphql with

query UserByUsername($username: String!) {userByUsername(username: <username>) {<queries here>} }

Headers should be:

'X-Requested-With': 'replit',
		'Origin': 'https://replit.com',
		'Accept': 'application/json',
		'Referrer': 'https://replit.com',
		'Content-Type': 'application/json',
		'Connection': 'keep-alive',
		'Host':"replit.com",
		"x-requested-with": "XMLHttpRequest",
		"User-Agent": "Mozilla/5.0"

(note that some of these values don’t really matter)

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.