Skip to content
Back

OpenID Connect ID Token Support for Integration

  • 0
  • Cloud
pearcy
16 Jan, 2025, 03:55

I'm trying to integrate Appwrite authentication with Convex backend. I believe that Convex requires an OpenID Connect ID tokens, but I can't find a way to get an OIDC-compliant ID token from Appwrite.

Current Setup: -- Successfully authenticating with Appwrite -- Can get JWT tokens from Appwrite -- Need to pass these to Convex Current Appwrite JWT format:

TypeScript
{
  sub: '67881a4942568fc06e77',
  iss: 'https://cloud.appwrite.io/v1',
  aud: '672d1490001071c7b24b',
  iat: 1736994725,
  exp: 1736998325
}

Code:

TypeScript
// src/components/providers/auth-provider.tsx
export function useAuthFromAppwrite() {
  const fetchAccessToken = useCallback(async ({ forceRefreshToken }: { forceRefreshToken: boolean }) => {
    try {
      const { jwt } = await account.createJWT();
      return jwt;
    } catch (error) {
      console.error("Token creation failed:", error);
      return null;
    }
  }, []);

  return {
    isLoading: false,
    isAuthenticated: true,
    fetchAccessToken
  };
}

error from Convex:

TypeScript
Failed to authenticate: "Could not parse as id token", check your server auth config

Does Appwrite support generating OpenID Connect ID tokens?

It's a React based app and I do have part of the project (API's, Database) working in Appwrite. Looking to migrate but need interim solution until I can get the rest migrated over.

TL;DR
Developers trying to integrate Appwrite authentication with Convex backend are facing issues as Convex requires an OpenID Connect ID token, which they can't get from Appwrite. They can successfully authenticate and obtain JWT tokens from Appwrite but need an OIDC-compliant ID token for Convex. The current Appwrite JWT format is provided. The code snippet for fetching access tokens from Appwrite is also included. The error message from Convex states that it could not parse the token as an ID token. The developer is seeking to know if Appwrite supports generating OpenID Connect ID tokens.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more