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/healthy-trainers-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@slashid/react": minor
---

Add the internal \_\_skipTokenValidation flag
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ jobs:
- name: Unit tests
run: pnpm test:unit

- name: Run E2E tests
env:
CI: true
MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }}
MAILOSAUR_SERVER_ID: ${{ secrets.MAILOSAUR_SERVER_ID }}
E2E_SID_API_URL: ${{ secrets.E2E_SID_API_URL }}
E2E_SID_API_KEY: ${{ secrets.E2E_SID_API_KEY }}
E2E_SID_ORG_ID: ${{ secrets.E2E_SID_ORG_ID }}
APP_NAME: ${{ matrix.app-name }}
run: pnpm test:e2e --filter tests
# - name: Run E2E tests
# env:
# CI: true
# MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }}
# MAILOSAUR_SERVER_ID: ${{ secrets.MAILOSAUR_SERVER_ID }}
# E2E_SID_API_URL: ${{ secrets.E2E_SID_API_URL }}
# E2E_SID_API_KEY: ${{ secrets.E2E_SID_API_KEY }}
# E2E_SID_ORG_ID: ${{ secrets.E2E_SID_ORG_ID }}
# APP_NAME: ${{ matrix.app-name }}
# run: pnpm test:e2e --filter tests

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
Expand Down
11 changes: 10 additions & 1 deletion packages/react/src/context/slash-id-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ export interface SlashIDProviderProps {
*/
onInitError?: (e: Error) => void;
themeProps?: ThemeProps;
/**
* Undocumented & private - do not use!
* SDK will assume that whatever token it finds (initial token, local storage) is valid.
* It won't issue API calls to validate the token before using it.
*/
__skipTokenValidation?: boolean;
children: ReactNode;
}

Expand Down Expand Up @@ -195,6 +201,7 @@ export function SlashIDProviderImplementation({
onInitError,
themeProps,
createSlashID,
__skipTokenValidation = false,
children,
}: SlashIDProviderImplementationProps) {
const [oid, setOid] = useState(initialOid);
Expand Down Expand Up @@ -238,6 +245,8 @@ export function SlashIDProviderImplementation({
return false;
}

if (__skipTokenValidation) return true;

try {
const ret = await tokenUser.validateToken();
return ret.valid;
Expand All @@ -246,7 +255,7 @@ export function SlashIDProviderImplementation({
return false;
}
},
[anonymousUsersEnabled]
[__skipTokenValidation, anonymousUsersEnabled]
);

const storeUser = useCallback(
Expand Down
Loading