React Native SDK doesn't support `custom-jwt` authentication type

Open Beginner friendly
#2,220 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
react-native, typescript

Research direction

Start in the React Native SDK's client.ts, reading validAuthenticatingTypes alongside completeAuthWithBundle and submitJwt. Reproduce authenticateAsync with type "custom-jwt" and confirm the flow no longer reports "Unsupported authenticating type" after the supported authentication types are aligned.

Written by the indexing model from the issue text.

Description

React Native SDK doesn't support custom-jwt authentication type

Environment

  • Package: @account-kit/react-native-signer version 4.66.2
  • Platform: React Native
  • Comparison: Web SDK (@account-kit/react) v4.65.0+ supports custom-jwt authentication

Description

The React Native SDK has a complete implementation of JWT authentication via the submitJwt method, but the authentication flow fails at runtime because "custom-jwt" is not included in the validAuthenticatingTypes array.

Current Behavior

When attempting to authenticate with a custom JWT using the following code:

await authenticateAsync({
  type: "custom-jwt",
  jwt: idToken,
});

The authentication fails with the error:

Error: Unsupported authenticating type

Root Cause

In node_modules/@account-kit/react-native-signer/src/client.ts at line 72-76:

private validAuthenticatingTypes: AuthenticatingEventMetadata["type"][] = [
  "email",
  "otp",
  "oauth",
];

The completeAuthWithBundle method (line 189-191) validates the authentication type:

if (!this.validAuthenticatingTypes.includes(params.authenticatingType)) {
  throw new Error("Unsupported authenticating type");
}

However, the submitJwt method (lines 167-179) is fully implemented and uses "custom-jwt":

override async submitJwt(
  args: Omit<JwtParams, "targetPublicKey">,
): Promise<JwtResponse> {
  this.eventEmitter.emit("authenticating", { type: "custom-jwt" });

  const publicKey = await this.stamper.init();
  return this.request("/v1/auth-jwt", {
    jwt: args.jwt,
    targetPublicKey: publicKey,
    authProvider: args.authProvider,
    expirationSeconds: args.expirationSeconds,
  });
}

Expected Behavior

The "custom-jwt" authentication type should be supported in React Native, just as it is in the Web SDK.

Proposed Fix

Add "custom-jwt" to the validAuthenticatingTypes array:

private validAuthenticatingTypes: AuthenticatingEventMetadata["type"][] = [
  "email",
  "otp",
  "oauth",
  "custom-jwt",  // Add this
];

Use Case

We are implementing a unified authentication flow where users:

  1. Authenticate with our OAuth provider (OIDC-compliant)
  2. Receive an ID token with a nonce generated from the Account Kit targetPublicKey
  3. Use that ID token to authenticate with Account Kit via custom JWT

This pattern is documented in the Alchemy docs:
https://www.alchemy.com/docs/wallets/authentication/login-methods/bring-your-own-auth

The Web SDK supports this flow perfectly, but React Native requires a workaround using type assertions to bypass the validation check.

Current Workaround

await authenticateAsync({
  type: "custom-jwt" as unknown as "email",
  jwt,
} as any);

This bypasses TypeScript type checking and the runtime validation, but it's not ideal and requires disabling linter rules.

Additional Context

All the infrastructure for custom JWT authentication already exists in the React Native SDK:

  • submitJwt method is implemented
  • ✅ Backend API endpoint /v1/auth-jwt is called
  • ✅ Event emission works correctly
  • ❌ Only the validation array is missing "custom-jwt"

This appears to be an oversight rather than an intentional limitation.

Impact

This prevents React Native developers from using the "Bring Your Own Auth" feature that is available in the Web SDK, limiting authentication options for mobile applications.

Dominant language
TypeScript
Stars
321
Forks
231
Avg merge
43m
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from alchemyplatform/aa-sdk

All issues in alchemyplatform/aa-sdk

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.