diff --git a/.changeset/eight-paws-add.md b/.changeset/eight-paws-add.md new file mode 100644 index 00000000000..d262779e82f --- /dev/null +++ b/.changeset/eight-paws-add.md @@ -0,0 +1,5 @@ +--- +'@clerk/clerk-expo': patch +--- + +Add a console error if the Native API is disabled for the instance. diff --git a/packages/expo/src/provider/singleton/createClerkInstance.ts b/packages/expo/src/provider/singleton/createClerkInstance.ts index b62d3d42c50..2a4f06b0ffd 100644 --- a/packages/expo/src/provider/singleton/createClerkInstance.ts +++ b/packages/expo/src/provider/singleton/createClerkInstance.ts @@ -168,12 +168,20 @@ export function createClerkInstance(ClerkClass: typeof Clerk) { } }); + let nativeApiErrorShown = false; // @ts-expect-error - This is an internal API __internal_clerk.__unstable__onAfterResponse(async (_: FapiRequestInit, response: FapiResponse) => { const authHeader = response.headers.get('authorization'); if (authHeader) { await saveToken(KEY, authHeader); } + + if (!nativeApiErrorShown && response.payload?.errors?.[0]?.code === 'native_api_disabled') { + console.error( + 'The Native API is disabled for this instance.\nGo to Clerk Dashboard > Configure > Native applications to enable it.\nOr, navigate here: https://dashboard.clerk.com/last-active?path=native-applications', + ); + nativeApiErrorShown = true; + } }); } return __internal_clerk;