sharma8471
07/11/2022, 1:07 AMsupertokens-website.js
import seems to be replaced with supertokens.js
and session.js
But this replacement had breaking changes, few I can see as following on the frontend side
2. supertokens.init()
function now seems to have different options schema. supertokens.init({apiDomain: ....})
seems to be replaced with supertokens.init({appInfo: {apiDomain: ....}})
.
3. appInfo
object appName
and recipeList
property seems to have become mandatory (earlier they were optional)
4. supertokens.signOut
fn seems to be removed. Will need to dig through doc for the replacement.
I am figuring these out as I see the errors popping up. It will be great if we can have a documentation of the breaking changes and if possible, a migration guidesharma8471
07/11/2022, 1:10 AMsupertokens-web-js
is needed only if I want add login UI? If I just want the sessions and reset password functionality, can I skip adding that?nkshah2
07/11/2022, 2:34 AMsharma8471
07/11/2022, 6:31 AMsharma8471
07/11/2022, 6:32 AMsharma8471
07/11/2022, 6:32 AMawait supertokens.signOut();
nkshah2
07/11/2022, 6:33 AMsupertokens-web-js
SDK then the sign out functions is exposed by the recipe you use. For example if you are using the EmailPassword recipe you would do:
import EmailPassword from "supertokens-web-js/recipe/emailpassword"
await EmailPassword.signOut()
nkshah2
07/11/2022, 6:37 AMsupertokens-website
should not be required unless you plan on using SuperTokens just for session management and not use any of our recipes
The migration might be a little tricky so if you have any questions moving from the website SDK to the web-js SDK feel free to ask them heresharma8471
07/11/2022, 4:05 PMsharma8471
07/11/2022, 4:06 PMnkshah2
07/11/2022, 4:09 PMimport Session from "supertokens-web-js/recipe/session"
await Session.attemptRefreshingSession()
sharma8471
07/13/2022, 7:59 PMsupertokensSession
vs Session
references. Could we have used Session
everywhere instead. Also could Session have been property of supertokens
object itself i.e. supertokens.session
would have been more intuitive for me
2. Also signout
fn at first seemed to be related to Session
and hence thought Session.logout
would have been more intuitive. Is there any diff between session.logout vs emailpassword.logout ?
I might be wrong but that's what I'd have assumed the structure of APIs when struggling to find the right infonkshah2
07/14/2022, 2:02 AMnkshah2
07/14/2022, 2:02 AMnkshah2
07/14/2022, 2:03 AMsharma8471
07/14/2022, 3:01 PMnkshah2
07/14/2022, 3:03 PMnkshah2
07/14/2022, 3:03 PMsharma8471
07/14/2022, 3:07 PMnkshah2
07/14/2022, 3:13 PM// Session (use with supertokensSession)
<script src="https://cdn.jsdelivr.net/gh/supertokens/supertokens-web-js/bundle/session.js"></script>
// Email Password (use with supertokensEmailPassword)
<script src="https://cdn.jsdelivr.net/gh/supertokens/supertokens-web-js/bundle/emailpassword.js"></script>
// Third Party (use with supertokensThirdParty)
<script src="https://cdn.jsdelivr.net/gh/supertokens/supertokens-web-js/bundle/thirdparty.js"></script>
// Third Party Email Password (use with supertokensThirdPartyEmailPassword)
<script src="https://cdn.jsdelivr.net/gh/supertokens/supertokens-web-js/bundle/thirdpartyemailpassword.js"></script>
// Passwordless (use with supertokensPasswordless)
<script src="https://cdn.jsdelivr.net/gh/supertokens/supertokens-web-js/bundle/passwordless.js"></script>
// Third party passwordless (use with supertokensThirdPartyPasswordless)
<script src="https://cdn.jsdelivr.net/gh/supertokens/supertokens-web-js/bundle/thirdpartypasswordless.js"></script>
nkshah2
07/14/2022, 3:14 PMnkshah2
07/14/2022, 3:14 PM<script src="https://cdn.jsdelivr.net/gh/supertokens/supertokens-web-js/bundle/supertokens.js"></script>
nkshah2
07/14/2022, 3:14 PMsharma8471
07/14/2022, 4:18 PMsendPasswordResetEmail
fnnkshah2
07/14/2022, 4:20 PMsupertokensEmailPassword.sendPasswordResetEmail(...)
sharma8471
07/14/2022, 4:21 PMnkshah2
07/14/2022, 4:21 PMsharma8471
07/14/2022, 4:37 PMsupertokensEmailPassword.sendPasswordResetEmail({formFields: [{....}]})
nkshah2
07/14/2022, 6:00 PM