supertokens / supertokens-golang

GoLang SDK for SuperTokens

Home Page:https://supertokens.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overrides doesn't work if not overriden inplace

sattvikc opened this issue · 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
		},
	},
})

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