
I’ve implemented a GitHub OAuth provider in Appwrite. Below is the code I used:
TypeScript
const handleGithubLogin = async () => {
const { account } = await createClient();
const session = account.createOAuth2Token({
provider: OAuthProvider.Github,
success: "http://localhost:3000/auth/callback",
failure: "http://localhost:3000/login",
});
console.log("session", session);
try {
} catch (error) {
console.log("error", error);
}
};
useEffect(() => {
const g = async () => {
const secret = searchParams.get("secret");
const userId = searchParams.get("userId");
try {
const session = await account.createSession({ userId, secret });
console.log("session", session);
} catch (error) {
console.log("error login callback", error);
}
};
g();
}, [searchParams]);
When I log the session, I get this response:
TypeScript
{
"$id": "68c0e94c6b1bcde19a82",
"$createdAt": "2025-09-10T02:58:20.441+00:00",
"$updatedAt": "2025-09-10T02:58:20.441+00:00",
"userId": "68c0e8fa19b89bd4df27",
"expire": "2026-09-10T02:58:20.495+00:00",
"provider": "oauth2",
"providerUid": "",
"providerAccessToken": "",
"providerAccessTokenExpiry": "",
"providerRefreshToken": "",
"ip": "113.212.111.174",
"osCode": "WIN",
"osName": "Windows",
"osVersion": "10",
"clientType": "browser",
"clientCode": "CH",
"clientName": "Chrome",
"clientVersion": "139.0",
"clientEngine": "Blink",
"clientEngineVersion": "139.0.0.0",
"deviceName": "desktop",
"countryCode": "bd",
"countryName": "Bangladesh",
"current": true,
"factors": ["email"],
"secret": "",
"mfaUpdatedAt": ""
}
The problem is that providerUid
is empty, even though the login seems successful.
👉 How can I properly retrieve the providerUid
from the GitHub OAuth session?
TL;DR
Issue: GitHub OAuth Provider Session is missing `providerUid`.
Solution:
The `providerUid` field is empty in the GitHub OAuth session. To properly retrieve the `providerUid` from the GitHub OAuth session, ensure that the GitHub provider is returning a unique identifier for the user. This unique identifier needs to be set as the `providerUid` in the session to fetch it accurately. Check the GitHub OAuth configuration and verify that the `providerUid` is being correctly assigned during the authentication process.Recommended threads
- Asynchronous Function Execution via Func...
Hi everyone, Is there a way to call a function via its function domain URL with async execution set to true?
- Appwrite + Google OAuth session created,...
Hey everyone, I’m running into a weird issue with Appwrite’s Google OAuth provider and would love some insight. Here’s my setup: - **Stack:** React app...
- Server Error when upserting existing and...
Hello there! Im currently experiencing issues with the not so long ago officially announced upserting funcionality. Im running appwrite 1.7.4 self hosted and no...
