Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eight-paws-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/clerk-expo': patch
---

Add a console error if the Native API is disabled for the instance.
8 changes: 8 additions & 0 deletions packages/expo/src/provider/singleton/createClerkInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<unknown>) => {
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;
Expand Down