All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Added new FDI version support: 3.1, 4.0
- Removed redundant calls to
removeToken
- Fixed an issue in the Axios interceptor that caused it to throw when encountering a network error
- Fixed the session refresh loop in all the request interceptors that occurred when an API returned a 401 response despite a valid session. Interceptors now attempt to refresh the session a maximum of ten times before throwing an error. The retry limit is configurable via the
maxRetryAttemptsForSessionRefresh
option.
- Adds FDI 2.0 and 3.0 to the list of supported FDI versions
- Fix a possible refresh loop in the axios interceptor
The shouldDoInterceptionBasedOnUrl
function now returns true:
- If
sessionTokenBackendDomain
is a valid subdomain of the URL's domain. This aligns with the behavior of browsers when sending cookies to subdomains. - Even if the ports of the URL you are querying are different compared to the
apiDomain
's port ot thesessionTokenBackendDomain
port (as long as the hostname is the same, or a subdomain of thesessionTokenBackendDomain
): supertokens/supertokens-website#217
- Support for new FDI version - 1.19
- Update test server to work with new node server versions
- Added debug logs to the SDK
- Update contributing Prerequisites
- Remove unused ESLint and Prettier config files from TestingApp
- use
URL
polyfill forshouldDoInterceptionBasedOnUrl
: #111
- Adds 1.18 to the list of FDI versions supported
- Fixed an issue where refreshing tokens could hang while an interactive looping animation is running
- Updates supported FDI versions to include
- Added
shouldDoInterceptionBasedOnUrl
as an overrideable function to the recipe interface
- Fixed an issue where the Authorization header was getting removed unnecessarily
- Refactors session logic to delete access token and refresh token if the front token is removed. This helps with proxies that strip headers with empty values which would result in the access token and refresh token to persist after signout
- Adds a check to make sure
SuperTokens.init
is called when using functions exposed by the SDK
- Adds tests based on changes in the session management logic in the backend SDKs and SuperTokens core
- Adds dashboard to the with-thirdpartyemailpassword example app server
- The SDK now only supports FDI version 1.16
- The backend SDK should be updated to a version supporting the header-based sessions!
- supertokens-node: >= 13.0.0
- supertokens-python: >= 0.12.0
- supertokens-golang: >= 0.10.0
- Properties passed when calling SuperTokens.init have been renamed:
cookieDomain
->sessionTokenBackendDomain
- The SDK now supports managing sessions via headers (using
Authorization
bearer tokens) instead of cookies - A new property has been added when calling SuperTokens.init:
tokenTransferMethod
. This can be used to configure whether the SDK should use cookies or headers for session management (header
by default). Refer to https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/sessions/token-transfer-method for more information
- Adds client id when initialising Google in the example app server
- Adds compatibility with FDI 1.15
- Adds FDI 1.14 in FDI array support
- Checks for GENERAL_ERROR status in signout API response and if it's there, we throw an error.
- Adds FDI 1.12 in FDI array support
- Workflow to verify if pr title follows conventional commits
- Adds FDI 1.12 in FDI array support
- Compatibility for FDI 1.11
- When calling a user's API, uses rid "anti-csrf" instead of session to solve supertokens/supertokens-node#202
- Supported FDI in frontendDriverSupported.json
- FDI 1.10 support (just changing the frontendDriverInterfaceSupported.json)
- Adding bundle size checking as GitHub action and CI step
- Uses non arrow functions in api and recipe interface impl to allow for "true" inheritance in override: supertokens/supertokens-node#199
- Uses
bind(this)
when calling original implementation
getJWTPayloadSecurely
has been renamed togetAccessTokenPayloadSecurely
to be more accurate to the functionality
This is a major update to the SDK and contains several breaking changes, please go through the list mentioned below and the documentation to understand how to upgrade to version 2.0.0
- Sign out support
- Adds
preAPIHook
andonHandleEvent
functions, when callinginit
SESSION_CREATED
event, which can be consumed byonHandleEvent
- Fires
UNAUTHORISED
event before attempting to refresh if we know that a session does not exist. - Fires
SIGN_OUT
event whensignOut
is called and a session doesn't exist. - Adds the ability to get userId and JWT payload (securely) from the frontend
- Sends
rid
on each request - acts as a CSRF protection measure - Adds
base-64
as a dependency - The ability to override functions when calling
init
- Automatically adds credentials to
fetch
andaxios
, this can be disabled when callinginit
- Changed success refresh call status code to >= 200 && < 300
- Network requests no longer send frontend SDK version
- New FDI supported versions -
1.8
and1.9
- Not calling refresh after API calls if the refresh API returned an error
- Not calling refresh after an 401 response has removed the session
- Enforce interception for fetch and axios for easier use
- Minor changes and refactors to the overall structure of the package
- The package now uses
@react-native-async-storage/async-storage
(instead of@react-native-community
) - Async storage is now a peer dependency, the package will not function properly unless you install
@react-native-async-storage/async-storage
version 1.12.1 or higher makeSuper
has been replaced byaddAxiosInterceptors
which is now exposed by the default import- The signature of the
init
function has changed - When importing from
"supertokens-react-native/axios"
theinit
function is no longer available. Refer to the documentation to know how to initialise SuperTokens when usingaxios
. - Changed the default session expiry status code to
401
- The refresh API will alway be
apiDomain + apiBasePath + "/session/refresh"
, bothapiDomain
andapiBasePath
are passed when callinginit
- Removes
refreshAPICustomHeaders
when callinginit
, usepreAPIHook
instead - Rejecting with axios response object if a call through axios gets an unexpected error during session refresh. This is a breaking change since it changes the API (even if it's an error).
- Removes the
get
,post
,put
,delete
andfetch
/axios
methods from the default/fetch
and/axios
imports. Use request/response interception instead, enabled by default forfetch
(view documentation foraxios
). - Removes the
doesSessionExist
function from the default/axios
import, it is now exposed fro mthe default import of the package for bothaxios
andfetch
- Refresh API succeeds if status code is >=200 && < 300
- Uses
@react-native-community/async-storage
- Compatibility with FDI 1.2
- Default session expiry status code is 401
- Changes to
init
function - If using
fetch
, makes that interception on by default
- Resolved cyclic dependency between index.tx and handleUnauthorised.ts