Skip to content
Open
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
2 changes: 1 addition & 1 deletion content/platform/authentication/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if (error) {
}

console.log('User created:', user.id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟣 Pre-existing: Sign-up quick starts read user.id from a sign-up that the SDK docs say returns no user

content/sdk/js/authentication.md:47 and content/sdk/js/error-handling.md:59 say signUp is session-less: it returns no user and no session unless signInWhenAllowed: true is passed. Two examples call signUp without that option and then read user.id: this page (line 48) and content/platform/databases/quick-start.md:56. A reader who copies either example would get a TypeError on user.id. This page's sample response (lines 54-67) also shows a populated session. This PR edits the line right below and neither introduces nor worsens the problem. The fix is to pass signInWhenAllowed: true or add a separate signIn step, as the SDK guide does.

Found by claude-opus-5-5

console.log('Access token:', session.access_token);
console.log('Session active:', Boolean(session));
```

The response includes the user object and a session with tokens:
Expand Down
2 changes: 1 addition & 1 deletion content/platform/authentication/volcano-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ if (error) {
window.location.href = '/login';
} else {
// Session refreshed, new tokens stored automatically
console.log('New access token:', session.access_token);
console.log('Session refreshed');
}
```

Expand Down
3 changes: 1 addition & 2 deletions content/platform/databases/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const { user, session } = await volcano.auth.signUp({
});

console.log('User ID:', user.id); // This is what auth.uid() returns in database
console.log('Access token:', session.access_token); // Automatically used for queries
console.log('Session active:', Boolean(session)); // Access token is used automatically for queries

// Or sign in existing user
await volcano.auth.signIn({
Expand Down Expand Up @@ -217,7 +217,6 @@ const response = await fetch('https://api.yourapp.com/auth/signup', {

const { access_token, user } = await response.json();
console.log('User ID:', user.id);
console.log('Access Token:', access_token);
// Save access_token for database queries!
```

Expand Down
6 changes: 3 additions & 3 deletions content/sdk/js/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,12 @@ 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();
console.log('Current session:', data.session);
console.log('Session active:', Boolean(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);
console.log('Session active:', Boolean(data.session));
} else if (error) {
console.error('Unable to load the user:', error.message);
} else {
Expand All @@ -167,7 +167,7 @@ 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);
console.log('Another auth operation established a session:', Boolean(data.session));
} else if (error) {
console.error('Sign-in failed:', error.message);
} else {
Expand Down
Loading