Repository navigation
fix: remove access token logging from examples #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,7 +46,6 @@ if (error) { | |
| } | ||
|
|
||
| console.log('User created:', user.id); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟣 Pre-existing: Signup examples assume the default response contains a user
Found by gpt-6.1-sol |
||
| console.log('Access token:', session.access_token); | ||
| ``` | ||
|
|
||
| The response includes the user object and a session with tokens: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,12 +138,10 @@ if (AuthRefreshDiscardedError.is(error)) { | |
| // Auth state changed while this request was pending. Read the current state | ||
| // or ask the user to retry; do not automatically replay a mutation. | ||
| const { data } = await volcano.auth.getSession(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the console.log lines gone, the three error-handling examples still run
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After removing the two console.log('Current session:', data.session) lines and the 'Another auth operation established:' one, each branch still runs const { data } = await volcano.auth.getSession(); but never uses data. The example now shows a call whose result is discarded, which reads as dead code to someone copying it. Same cosmetic residue applies to the now-unused session variable in authentication/quickstart.md line 38, volcano-sdk.md line 319, and databases/quick-start.md line 51. Suggested change: Either drop the destructuring (await volcano.auth.getSession(); with a comment such as // Re-read the current session before deciding what to show) or use the result without printing the token, for example: const { data } = await volcano.auth.getSession(); if (!data.session) { /* redirect to login */ }
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ P3: Error-handling examples now fetch the session and discard it With the log lines removed, all three branches (lines 140, 144, 167) still run Found by claude-opus-5-5
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ P3: Concurrency recovery examples discard the session they read All three recovery branches now fetch Found by gpt-6.1-sol |
||
| console.log('Current session:', data.session); | ||
| } else if (AuthSessionChangedError.is(error)) { | ||
| // The user response belongs to a session that was replaced while the | ||
| // request was pending. | ||
| const { data } = await volcano.auth.getSession(); | ||
| console.log('Current session:', data.session); | ||
| } else if (error) { | ||
| console.error('Unable to load the user:', error.message); | ||
| } else { | ||
|
|
@@ -167,7 +165,6 @@ const { user, error } = await volcano.auth.signIn({ | |
|
|
||
| if (AuthSessionChangedError.is(error)) { | ||
| const { data } = await volcano.auth.getSession(); | ||
| console.log('Another auth operation established:', data.session); | ||
| } else if (error) { | ||
| console.error('Sign-in failed:', error.message); | ||
| } else { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟣 Pre-existing: Sign-up examples read
user.idalthough the SDK docs say sign-up returns no usercontent/sdk/js/authentication.md:47sayssignUp()withoutsignInWhenAllowed: truereturns no user and no session. Yetcontent/platform/authentication/quickstart.md:38-48andcontent/platform/databases/quick-start.md:51-56callsignUp()without that option and then readuser.id. A reader following either quickstart gets a TypeError on a nulluser. Line 51 of the auth quickstart also says the response "includes the user object and a session with tokens". This PR doesn't cause the problem (the removedsession.access_tokenline would have thrown too), but these blocks are the ones it edits. Fix: passsignInWhenAllowed: trueor add an explicitsignInstep, and correct the response description.Found by claude-opus-5-5