Closed leoujz closed 2 years ago
Does uni use XHR underneath? Cause supertokens-website also adds interceptors to XHR when the init function is called.
Not really XHR underneath, uni app use uni.request
and will make it compatible with multi platforms, like ios, android, web, desktop, miniprograms of many differnent platforms.
Is there a way to override the HTTP request of supertokens-web-js, and let me implement it on my own.
Well yea. If uni is not using XHR
, nor is it using fetch
, then you supertokens-website repo won't interfere with the requests anyway.
For things like checking if a session exists etc, you can override the doesSessionExist function using the override config when you do supertokens.init. There are other functions in the interface too which you could override.
Closing this issue, since it's not really a bug in SuperTokens
My issuse is that I want to make supertokens frontend sdk working in uni-app environment (js + vue), which is a platform to make wechat/alipay miniprogram. Firstly I tried supertokens-web-js, which use supertokens-website library for session managment. But the supertokens-website is incompatible with uniapp environment, because uniapp mini program environment does support
window.fetch
.I want to modify the source code or override some functions of supertokens-web-js to make it work with uniapp. I think one of the key points is using localstorage instead of cookies and adding interceptors to http request. For localstorage problem, I already tried the localstorage example and it works.
uniapp use code
uni.request()
to do http request, I want to overide the default http request behavior in supertokens-web-js.I know that you might not be familiar with uniapp, but some hints would help a lot.