snow
12/03/2021, 2:24 PMrp
12/03/2021, 2:25 PMrp
12/03/2021, 2:25 PMgo
errr := supertokens.Init(supertokens.TypeInput{
Supertokens: &supertokens.ConnectionInfo{
// These are the connection details of the app you created on supertokens.io
ConnectionURI: "http://localhost:3567/",
APIKey: "",
},
AppInfo: supertokens.AppInfo{
AppName: "GOInfluencer",
APIDomain: "http://localhost:8080/",
WebsiteDomain: "http://localhost:8081/",
},
RecipeList: []supertokens.Recipe{
emailpassword.Init(&epmodels.TypeInput{
ResetPasswordUsingTokenFeature: &epmodels.TypeInputResetPasswordUsingTokenFeature{CreateAndSendCustomEmail: func(user epmodels.User, passwordResetURLWithToken string) {
fmt.Println(passwordResetURLWithToken)
}},
}),
session.Init(nil),
},
})
if errr != nil {
panic(errr.Error())
}
rp
12/03/2021, 2:26 PMsnow
12/03/2021, 2:26 PMsnow
12/03/2021, 2:28 PMrp
12/03/2021, 2:28 PMsnow
12/03/2021, 2:29 PMrp
12/03/2021, 2:35 PMsnow
12/03/2021, 2:35 PMrp
12/03/2021, 2:36 PMgo
package main
import (
"fmt"
"net/http"
"github.com/go-chi/chi/v5"
"github.com/go-chi/cors"
"github.com/supertokens/supertokens-golang/recipe/emailpassword"
"github.com/supertokens/supertokens-golang/recipe/emailpassword/epmodels"
"github.com/supertokens/supertokens-golang/recipe/session"
"github.com/supertokens/supertokens-golang/supertokens"
)
func main() {
err := supertokens.Init(supertokens.TypeInput{
Supertokens: &supertokens.ConnectionInfo{
ConnectionURI: "https://try.supertokens.io",
},
AppInfo: supertokens.AppInfo{
AppName: "SuperTokens Demo App",
APIDomain: "http://localhost:3001",
WebsiteDomain: "http://localhost:3000",
},
RecipeList: []supertokens.Recipe{
emailpassword.Init(&epmodels.TypeInput{
ResetPasswordUsingTokenFeature: &epmodels.TypeInputResetPasswordUsingTokenFeature{CreateAndSendCustomEmail: func(user epmodels.User, passwordResetURLWithToken string) {
fmt.Println(passwordResetURLWithToken)
}},
}),
session.Init(nil),
},
})
if err != nil {
panic(err.Error())
}
r := chi.NewRouter()
r.Use(cors.Handler(cors.Options{
AllowedOrigins: []string{"http://localhost:3000"},
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
AllowedHeaders: append([]string{"Content-Type"}, supertokens.GetAllCORSHeaders()...),
AllowCredentials: true,
}))
r.Use(supertokens.Middleware)
http.ListenAndServe(":3001", r)
}
rp
12/03/2021, 2:36 PMhttp://localhost:3000/auth/reset-password?token=YmNlYjgyNjkzY2VhZDRjZGQzMTcyNjlmMWM2YzU5NzIzZTRk....0ZWMwMmUz&rid=emailpassword
as the output on the consolesnow
12/03/2021, 2:36 PMrp
12/03/2021, 2:37 PMrp
12/03/2021, 2:37 PMsnow
12/03/2021, 2:37 PMsnow
12/03/2021, 2:38 PMrp
12/03/2021, 2:39 PMrp
12/03/2021, 2:39 PMsnow
12/03/2021, 2:39 PMsnow
12/03/2021, 2:39 PMrp
12/03/2021, 2:40 PMsnow
12/03/2021, 2:40 PMrp
12/03/2021, 2:40 PMsnow
12/03/2021, 3:29 PMrp
12/03/2021, 3:30 PMsnow
12/03/2021, 4:02 PMrp
12/03/2021, 4:05 PMishank
12/03/2021, 4:20 PMrp
12/03/2021, 4:27 PM+brand
to it. So user@example.com would become user+brand@example.com
- If it's a normal user signing in / up, then change their email to add a +user
to it, similarly to the above point.
This way, even if these users are all in the same user pool, a person can use the same email for both a brand and a user. This does not actually affect sending emails to them.
> Different subdomains & Login on client side would be different on their respected subdomains
Alright. Follow up questions:
- Are you using our supertokens-auth-react package on the frontend or supertokens-website?
- After logging in, would those users be redirected to a different sub domain or stay within their own sub domain?