urbansson
04/25/2023, 11:47 AMtokenTransferMethod: "header"
flow instead of the cookie based one as suggested. Everything works fine in chrome and firefox, the authorization
header gets set with the expected value and the backend is able to authenticate the request.
But in safari no header is provided, which causes the flow to not work. The consome call for the otp works fine and we get a response from the server containing all the expected tokens. But the following request to the api does not contain anything and returns with a 401.
After digging around a bit it in https://github.com/supertokens/supertokens-website/blob/master/lib/ts/fetch.ts it looks like even when using the header mode all the tokens still gets stored as cookies by the client and this will then also fail because of itp.
But setting values in localstorage/session should still work, with some limitations, but it should get the flow running as expected for the current session at least. So is there a way to totally disable cookies and only store all the tokens in local storage when header mode is active?rp_st
04/25/2023, 11:49 AMurbansson
04/25/2023, 11:54 AMtypescript
export const config: SuperTokensConfig = {
appInfo: {
apiDomain: getApiHost(), // Resolves to https://192.168.1.7:6789
apiBasePath: "/auth",
appName: 'Test App',
},
enableDebugLogs: true,
recipeList: [
Passwordless.init(),
Session.init({
isInIframe: true,
tokenTransferMethod: "header"
}),
],
};
rp_st
04/25/2023, 11:54 AMurbansson
04/25/2023, 11:54 AMSuperTokens.init(config);
rp_st
04/25/2023, 11:56 AMurbansson
04/25/2023, 11:57 AMdocument.cookie ="foo"
and then trying to access it with document.cookie
returns empty string. So I'm not sure setting cookies in the frontend works. In firefox it does.alisheraituarov
04/25/2023, 12:10 PMPasswordless.init()
is missing configrp_st
04/25/2023, 12:10 PMrp_st
04/25/2023, 12:11 PMalisheraituarov
04/25/2023, 12:13 PMrp_st
04/25/2023, 1:01 PMurbansson
04/25/2023, 1:05 PMdocument.requestStorageAccess()
in safari.
But both of those flows works but are a bit of a inconvenience for us. We would like it for the login work for the session and can accept that we lose it when the user closes the tab/browserrp_st
04/25/2023, 1:17 PMrp_st
04/25/2023, 1:19 PMrp_st
04/25/2023, 1:19 PMurbansson
04/25/2023, 1:24 PMrp_st
04/25/2023, 1:25 PMurbansson
04/25/2023, 1:29 PMrp_st
04/25/2023, 1:31 PMrp_st
04/25/2023, 1:31 PMrp_st
04/25/2023, 1:51 PMurbansson
04/25/2023, 1:55 PMurbansson
04/25/2023, 1:55 PMrp_st
04/25/2023, 2:12 PMrp_st
04/25/2023, 3:59 PMlocation
config - that's specific to the demo app.
And here is a cookieHandler: https://github.com/supertokens/supertokens-auth-react/blob/master/examples/with-next-iframe/config/cookieHandler.js
Finally, they need to be added to the supertokens.init on the frontend as seen here: https://github.com/supertokens/supertokens-auth-react/blob/master/examples/with-next-iframe/config/frontendConfig.js
You will need to refetch our SDKs (remove package-lock.json / yarn.lock), remove node_modules, clear node_module cache and redownload. Make sure that you have version 16.0.8
of the node_modules/supertokens-website
repo (which contains the update)
If you do not get the latest version of the supertokens-website SDK yet, try again after sometime (~1 hour maybe) - sometimes npm is slow to propagate changes.urbansson
04/25/2023, 4:03 PMrp_st
04/25/2023, 4:03 PMurbansson
04/26/2023, 11:35 AMrp_st
04/26/2023, 12:12 PMrp_st
04/26/2023, 12:12 PMsetKeyValue
function call and after it?rp_st
04/26/2023, 12:12 PMrp_st
04/26/2023, 12:13 PMurbansson
04/26/2023, 12:23 PMsetKeyValue
urbansson
04/26/2023, 12:23 PMrp_st
04/26/2023, 12:25 PMrp_st
04/26/2023, 12:25 PMrp_st
04/26/2023, 12:26 PMurbansson
04/26/2023, 12:27 PMrp_st
04/26/2023, 12:27 PMrp_st
04/26/2023, 12:35 PMrp_st
04/26/2023, 12:35 PMurbansson
04/26/2023, 12:36 PMrp_st
04/26/2023, 12:36 PM