supertokens/supertokens-flutter

Cookie auth mode hard coded

Closed this issue · 7 comments

Hi,
Any reason why the cookie based auth is hard coded at?

refreshReq.headers.addAll({'st-auth-mode': 'cookie'});

If I change it to match

SuperTokensTokenTransferMethod tokenTransferMethod =

The header based auth forced by my backend works.

This seems to be a bug. We will fix it asap.

Hi @trivialkettle

Can you post the config on both the frontend and backend you were using initially? Also were you facing any issues?

Frontend (flutter):

 SuperTokens.init(
      apiDomain: "http://localhost:3001",
      apiBasePath: 'auth',
      tokenTransferMethod: SuperTokensTokenTransferMethod.HEADER);

Backend (go):

return supertokens.TypeInput{
		Supertokens: &supertokens.ConnectionInfo{
			ConnectionURI: config.Core,
			APIKey:        config.Apikey,
		},
		AppInfo: supertokens.AppInfo{
			AppName:       appName,
			APIDomain:     config.Api,
			WebsiteDomain: config.Website,
		},
		RecipeList: []supertokens.Recipe{
			session.Init(&sessmodels.TypeInput{
				GetTokenTransferMethod: func(req *http.Request, forCreateNewSession bool, userContext supertokens.UserContext) sessmodels.TokenTransferMethod {
					return sessmodels.HeaderTransferMethod
				},
			}),
		},
	}

I hardcoded the token transfer mode to header based. I read the warnings and infos at https://supertokens.com/docs/emailpassword/common-customizations/sessions/token-transfer-method, but had to use it to do some tests with curl.

Edit: I faced the issue in attemptRefreshingSession()

Edit: I faced the issue in attemptRefreshingSession()

What issue did you face? Cause according to us, it should have just worked regardless of the hard coding.

attemptRefreshingSession() returned false.
Right after a successful login. So the session should not be expired.

We can try and replicate this issue. Will get back

Hey @trivialkettle

This has been fixed in version 0.2.8. Closing this for now, feel free to re-open if the issue persists