Skip to content
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

[fix] Call SIGNED_OUT event where session is removed #854

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
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
6 changes: 5 additions & 1 deletion src/GoTrueClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1874,7 +1874,7 @@ export default class GoTrueClient {
}

/**
* Recovers the session from LocalStorage and refreshes
* Recovers the session from LocalStorage and refreshes the token
* Note: this method is async to accommodate for AsyncStorage e.g. in React native.
*/
private async _recoverAndRefresh() {
Expand All @@ -1889,6 +1889,7 @@ export default class GoTrueClient {
this._debug(debugName, 'session is not valid')
if (currentSession !== null) {
await this._removeSession()
await this._notifyAllSubscribers('SIGNED_OUT', null)
}

return
Expand Down Expand Up @@ -1916,6 +1917,7 @@ export default class GoTrueClient {
error
)
await this._removeSession()
await this._notifyAllSubscribers('SIGNED_OUT', null)
}
}
}
Expand Down Expand Up @@ -2083,10 +2085,12 @@ export default class GoTrueClient {
// finished and tests run endlessly. This can be prevented by calling
// `unref()` on the returned object.
ticker.unref()
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
} else if (typeof Deno !== 'undefined' && typeof Deno.unrefTimer === 'function') {
// similar like for NodeJS, but with the Deno API
// https://deno.land/api@latest?unstable&s=Deno.unrefTimer
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Deno.unrefTimer(ticker)
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ export type AuthMFAEnrollResponse =
friendly_name?: string

/** Phone number of the MFA factor in E.164 format. Used to send messages */
phone: string
phone: string
}
error: null
}
Expand Down