I want to access user's github info
(I tried using this, after creating a session https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user but it didn't work, it does return a user but its not equal to the current user, not really sure why;-; So I wana try other approach)
There can be multiple reasons why that doesn't work, one of them being that Appwrite handles the OAuth, not you, if that makes sense.
That being said, what exact information do you want from the user's github?
I'm not sure how to go about it just yet, but maybe more info will help me think of something.
I just need the username, I have a function that takes github username as input and returns info like languages used in repos etc
Let me look into this and see if I find something
hey did u find anything;-;
Unfortunately, no. I've asked the team to take a look, and if there's any findings, I'll be sure to post them here
At the moment, Isn't possible to get any other data, we just get the email:
https://github.com/appwrite/appwrite/blob/master/src/Appwrite/Auth/OAuth2/Github.php#L166-L184
If you are using a selfhost version you can override the github logic and update to do what you want
did you try to fetch the OAuth2 session?
Hi, Im looking for the same think. I want to add username for each Appwrite user but with Oauth idk how manage that because we cant add username (with createDocument....)
How are you getting the username?
why can't you add it with createDocument()
after user signs in with OAuth?
But i dont want to get the username from github because if the github username is already used by an user in my Appwrite instance that gonna be a problem
The only way that ive found to solve the problem is when u login, there is a check if user.username exist. If not, a modal open when to let the user add his username
Yeah, I did the same thing
ive got a better idea
Because the modal can be deleted in F12 etc...
Ive check how Twitter managed the signup with OAuth
And they create a default username based on the name. Like if the name is Brad Pitt, the username gonna be bradpitt, or bradpitt1, or bradpitt4684, etc...
So my idea is to create an Appwrite Function triggered by user.*.create and inside check is a document with username exist on the user
collection. If true (case : signup with email) return. If false (case: signup OAuth), add document with a username based on the user Name
Ive a function who generate username based on the name of the user. Ive post my function here : https://discord.com/channels/564160730845151244/1122954494909632542/1123032987009826870
Recommended threads
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...