Skip to content

Commit e8f952a

Browse files
feat: always add URI to SIWE payload (#5172)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on ensuring that a URI is always included in the SIWE payload by modifying the logic in the `generate-login-payload.ts` file and updating the corresponding test. ### Detailed summary - In `generate-login-payload.ts`, the `uri` field is updated to default to `options.domain` if `options.login?.uri` is not provided. - In `generate-login-payload.test.ts`, the test case for `uri` is changed to use `"example.com"` instead of `undefined`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 132ccd3 commit e8f952a

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.changeset/soft-weeks-know.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Always add URI to SIWE payload

packages/thirdweb/src/auth/core/generate-login-payload.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ describe("generateLoginPayload", () => {
8989
"issued_at": "1970-01-01T00:00:00.000Z",
9090
"resources": undefined,
9191
"statement": "Please ensure that the domain above matches the URL of the current website.",
92-
"uri": undefined,
92+
"uri": "example.com",
9393
"version": "1",
9494
}
9595
`);

packages/thirdweb/src/auth/core/generate-login-payload.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function generateLoginPayload(options: AuthOptions) {
4646
statement: options.login?.statement || DEFAULT_LOGIN_STATEMENT,
4747
version: options.login?.version || DEFAULT_LOGIN_VERSION,
4848
resources: options.login?.resources,
49-
uri: options.login?.uri,
49+
uri: options.login?.uri || options.domain,
5050
};
5151
};
5252
}

0 commit comments

Comments
 (0)