I’ve implemented a GitHub OAuth provider in Appwrite. Below is the code I used:
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:
{
"$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?
Recommended threads
- Problem with Google Workspace at DNS Rec...
Hello, I bought a domain at Namecheap, and Google Workspace used to work there, but now that I switched from Custom DNS to Appwrite's nameservers, it doesn't w...
- Flutter OAuth2 webAuth Bug?
I created with flutter an app where I can login in with my Microsoft Account. When I compile it to Web (WASM) or Android (aab) then there is no problem what so ...
- change role of a team member in Appwrite
It's not possible to add/change roles of a team meber in Appwrite Frontend. When you click on a member of a team you get forwarded to the configuration page of ...