supertokens-golang icon indicating copy to clipboard operation
supertokens-golang copied to clipboard

Overrides doesn't work if not overriden inplace

Open sattvikc opened this issue 2 years ago • 1 comments

For example

session.Init(&sessmodels.TypeInput{
	AntiCsrf: &customAntiCsrfVal,
	Override: &sessmodels.OverrideStruct{
		Functions: func(originalImplementation sessmodels.RecipeInterface) sessmodels.RecipeInterface {
			oGetSessionInformation := *originalImplementation.GetSessionInformation
			nGetSessionInformation := func(sessionHandle string, userContext supertokens.UserContext) (*sessmodels.SessionInformation, error) {
				info, err := oGetSessionInformation(sessionHandle, userContext)
				if err != nil {
					return nil, err
				}
				info.SessionData = map[string]interface{}{
					"test": 1,
				}
				return info, nil
			}
			originalImplementation.GetSessionInformation = &nGetSessionInformation
			return originalImplementation
		},
	},
})

sattvikc avatar Aug 08 '22 07:08 sattvikc

I encountered the same problem when override signInUp function. @sattvikc Did you manage to solve the problem somehow?

mkrou avatar Feb 14 '24 11:02 mkrou