Skip to content

Commit

Permalink
Merge pull request #403 from supertokens/remove-combination-recipe/base
Browse files Browse the repository at this point in the history
Removes combination recipe (base pr)
  • Loading branch information
rishabhpoddar authored May 24, 2024
2 parents 7a18446 + afd9b0f commit 533bd14
Show file tree
Hide file tree
Showing 109 changed files with 5,635 additions and 17,824 deletions.
127 changes: 127 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,133 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.20.0] - 2024-05-23

### Breaking change

- Removed ThirdPartyEmailPassword and ThirdPartyPasswordless recipes. Instead, you should use ThirdParty + EmailPassword or ThirdParty + Passwordless recipes separately in your recipe list.
- Removed `rid` query param from:
- email verification links
- passwordless magic links
- password reset links

### Changes

- If `rid` header is present in an API call, the routing no only only depends on that. If the SDK cannot resolve a request handler based on the `rid`, request path and method, it will try to resolve a request handler only based on the request path and method (therefore ignoring the `rid` header).
- New API handlers are:
- `GET /emailpassword/email/exists` => email password, does email exist API (used to be `GET /signup/email/exists` with `rid` of `emailpassword` or `thirdpartyemailpassword` which is now deprecated)
- `GET /passwordless/email/exists` => email password, does email exist API (used to be `GET /signup/email/exists` with `rid` of `passwordless` or `thirdpartypasswordless` which is now deprecated)
- `GET /passwordless/phonenumber/exists` => email password, does email exist API (used to be `GET /signup/phonenumber/exists` which is now deprecated)
- Support for FDI 2.0

### Migration guide

- If you were using `ThirdPartyEmailPassword`, you should now init `ThirdParty` and `EmailPassword` recipes separately. The config for the individual recipes are mostly the same, except the syntax may be different. Check our recipe guides for [ThirdParty](https://supertokens.com/docs/thirdparty/introduction) and [EmailPassword](https://supertokens.com/docs/emailpassword/introduction) for more information.

- If you were using `ThirdPartyPasswordless`, you should now init `ThirdParty` and `Passwordless` recipes separately. The config for the individual recipes are mostly the same, except the syntax may be different. Check our recipe guides for [ThirdParty](https://supertokens.com/docs/thirdparty/introduction) and [Passwordless](https://supertokens.com/docs/passwordless/introduction) for more information.

- The way to get user information has changed:
- If you are using `thirdpartyemailpassword.GetUsersByEmail`:

Before:
```go
userInfo, err := thirdpartyemailpassword.GetUsersByEmail("public", "[email protected]")
```

After:
```go
thirdPartyUserInfo, err := thirdparty.GetUsersByEmail("public", "[email protected]")
if err != nil {
// TODO: Handle error
}

emailPasswordUserInfo, err := emailpassword.GetUserByEmail("public", "[email protected]")
if err != nil {
// TODO: Handle error
}

if emailPasswordUserInfo != nil {
fmt.Println(emailPasswordUserInfo)
}
if len(thirdPartyUserInfo) > 0 {
fmt.Println(thirdPartyUserInfo)
}
```

- If you are using `thirdpartyemailpassword.GetUserById`:

Before:
```go
userInfo, err := thirdpartyemailpassword.GetUserById(userID)
```

After:
```go
userInfo, err := thirdparty.GetUserByID(userID)
if err != nil {
// TODO: Handle error
}
if userInfo == nil {
emailPasswordUserInfo, err := emailpassword.GetUserByID(userID)
if err != nil {
// TODO: Handle error
}
fmt.Println(emailPasswordUserInfo)
} else {
fmt.Println(userInfo)
}
```
- If you are using `thirdpartypasswordless.GetUsersByEmail`:

Before:
```go
userInfo, err := thirdpartypasswordless.GetUsersByEmail("public", "[email protected]")
```

After:
```go
thirdPartyUserInfo, err := thirdparty.GetUsersByEmail("public", "[email protected]")
if err != nil {
return
}
passwordlessUserInfo, err := passwordless.GetUserByEmail("public", "[email protected]")
if err != nil {
return
}
if passwordlessUserInfo != nil {
fmt.Println(passwordlessUserInfo)
}
if len(thirdPartyUserInfo) > 0 {
fmt.Println(thirdPartyUserInfo)
}
```

- If you are using `thirdpartypasswordless.GetUserById`:

Before:
```go
userInfo, err := thirdpartypasswordless.GetUserById(userID)
```

After:
```go
userInfo, err := thirdparty.GetUserByID(userID)
if err != nil {
// TODO: Handle error
}
if userInfo == nil {
passwordlessUserInfo, err := passwordless.GetUserByID(userID)
if err != nil {
// TODO: Handle error
}
fmt.Println(passwordlessUserInfo)
} else {
fmt.Println(userInfo)
}
```

## [0.19.0] - 2024-05-01

- Added `OlderCookieDomain` config option in the session recipe. This will allow users to clear cookies from the older domain when the `CookieDomain` is changed.
Expand Down
187 changes: 94 additions & 93 deletions examples/with-chi-oso/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import (
"github.com/supertokens/supertokens-golang/recipe/emailverification"
"github.com/supertokens/supertokens-golang/recipe/emailverification/evmodels"
"github.com/supertokens/supertokens-golang/recipe/session"
"github.com/supertokens/supertokens-golang/recipe/thirdparty"
"github.com/supertokens/supertokens-golang/recipe/thirdparty/tpmodels"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword/tpepmodels"
"github.com/supertokens/supertokens-golang/supertokens"
)

Expand All @@ -37,111 +36,113 @@ func main() {
emailverification.Init(evmodels.TypeInput{
Mode: evmodels.ModeRequired,
}),
thirdpartyemailpassword.Init(&tpepmodels.TypeInput{
Providers: []tpmodels.ProviderInput{
// We have provided you with development keys which you can use for testsing.
// IMPORTANT: Please replace them with your own OAuth keys for production use.
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "google",
Clients: []tpmodels.ProviderClientConfig{
{
ClientType: "web",
ClientID: "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
ClientSecret: "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",
},
{
// we use this for mobile apps
ClientType: "mobile",
ClientID: "1060725074195-c7mgk8p0h27c4428prfuo3lg7ould5o7.apps.googleusercontent.com",
ClientSecret: "", // this is empty because we follow Authorization code grant flow via PKCE for mobile apps (Google doesn't issue a client secret for mobile apps).
thirdparty.Init(&tpmodels.TypeInput{
SignInAndUpFeature: tpmodels.TypeInputSignInAndUp{
Providers: []tpmodels.ProviderInput{
// We have provided you with development keys which you can use for testsing.
// IMPORTANT: Please replace them with your own OAuth keys for production use.
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "google",
Clients: []tpmodels.ProviderClientConfig{
{
ClientType: "web",
ClientID: "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
ClientSecret: "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",
},
{
// we use this for mobile apps
ClientType: "mobile",
ClientID: "1060725074195-c7mgk8p0h27c4428prfuo3lg7ould5o7.apps.googleusercontent.com",
ClientSecret: "", // this is empty because we follow Authorization code grant flow via PKCE for mobile apps (Google doesn't issue a client secret for mobile apps).
},
},
},
},
},
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "github",
Clients: []tpmodels.ProviderClientConfig{
{
ClientType: "web",
ClientID: "467101b197249757c71f",
ClientSecret: "e97051221f4b6426e8fe8d51486396703012f5bd",
},
{
// We use this for mobile apps
ClientType: "mobile",
ClientID: "8a9152860ce869b64c44",
ClientSecret: "00e841f10f288363cd3786b1b1f538f05cfdbda2",
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "github",
Clients: []tpmodels.ProviderClientConfig{
{
ClientType: "web",
ClientID: "467101b197249757c71f",
ClientSecret: "e97051221f4b6426e8fe8d51486396703012f5bd",
},
{
// We use this for mobile apps
ClientType: "mobile",
ClientID: "8a9152860ce869b64c44",
ClientSecret: "00e841f10f288363cd3786b1b1f538f05cfdbda2",
},
},
},
},
},
/*
For Apple signin, iOS apps always use the bundle identifier as the client ID when communicating with Apple. Android, Web and other platforms
need to configure a Service ID on the Apple developer dashboard and use that as client ID.
In the example below 4398792-io.supertokens.example.service is the client ID for Web. Android etc and thus we mark it as default. For iOS
the frontend for the demo app sends the clientId in the request which is then used by the SDK.
*/
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "apple",
Clients: []tpmodels.ProviderClientConfig{
{
// For Android and website apps
ClientType: "web",
ClientID: "4398792-io.supertokens.example.service",
AdditionalConfig: map[string]interface{}{
"keyId": "7M48Y4RYDL",
"privateKey": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
"teamId": "YWQCXGJRJL",
/*
For Apple signin, iOS apps always use the bundle identifier as the client ID when communicating with Apple. Android, Web and other platforms
need to configure a Service ID on the Apple developer dashboard and use that as client ID.
In the example below 4398792-io.supertokens.example.service is the client ID for Web. Android etc and thus we mark it as default. For iOS
the frontend for the demo app sends the clientId in the request which is then used by the SDK.
*/
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "apple",
Clients: []tpmodels.ProviderClientConfig{
{
// For Android and website apps
ClientType: "web",
ClientID: "4398792-io.supertokens.example.service",
AdditionalConfig: map[string]interface{}{
"keyId": "7M48Y4RYDL",
"privateKey": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
"teamId": "YWQCXGJRJL",
},
},
},
{
// For iOS Apps
ClientType: "ios",
ClientID: "4398792-io.supertokens.example",
AdditionalConfig: map[string]interface{}{
"keyId": "7M48Y4RYDL",
"privateKey": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
"teamId": "YWQCXGJRJL",
{
// For iOS Apps
ClientType: "ios",
ClientID: "4398792-io.supertokens.example",
AdditionalConfig: map[string]interface{}{
"keyId": "7M48Y4RYDL",
"privateKey": "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----",
"teamId": "YWQCXGJRJL",
},
},
},
},
},
},
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "discord",
Clients: []tpmodels.ProviderClientConfig{
{
ClientType: "web",
ClientID: "4398792-907871294886928395",
ClientSecret: "His4yXGEovVp5TZkZhEAt0ZXGh8uOVDm",
},
{
// We use this for mobile apps
ClientType: "mobile",
ClientID: "4398792-907871294886928395",
ClientSecret: "His4yXGEovVp5TZkZhEAt0ZXGh8uOVDm",
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "discord",
Clients: []tpmodels.ProviderClientConfig{
{
ClientType: "web",
ClientID: "4398792-907871294886928395",
ClientSecret: "His4yXGEovVp5TZkZhEAt0ZXGh8uOVDm",
},
{
// We use this for mobile apps
ClientType: "mobile",
ClientID: "4398792-907871294886928395",
ClientSecret: "His4yXGEovVp5TZkZhEAt0ZXGh8uOVDm",
},
},
},
},
},
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "google-workspaces",
Clients: []tpmodels.ProviderClientConfig{
{
ClientType: "web",
ClientID: "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
ClientSecret: "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",
},
{
// We use this for mobile apps
ClientType: "mobile",
ClientID: "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
ClientSecret: "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",
{
Config: tpmodels.ProviderConfig{
ThirdPartyId: "google-workspaces",
Clients: []tpmodels.ProviderClientConfig{
{
ClientType: "web",
ClientID: "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
ClientSecret: "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",
},
{
// We use this for mobile apps
ClientType: "mobile",
ClientID: "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com",
ClientSecret: "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",
},
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions examples/with-chi-oso/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/osohq/go-oso"
"github.com/supertokens/supertokens-golang/examples/with-chi-oso/models"
"github.com/supertokens/supertokens-golang/recipe/session"
"github.com/supertokens/supertokens-golang/recipe/thirdpartyemailpassword"
"github.com/supertokens/supertokens-golang/recipe/thirdparty"
"github.com/supertokens/supertokens-golang/supertokens"
)

Expand Down Expand Up @@ -92,7 +92,7 @@ func (s *service) Repo(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(err.Error()))
return
}
userByID, err := thirdpartyemailpassword.GetUserById(sessionContainer.GetUserID())
userByID, err := thirdparty.GetUserByID(sessionContainer.GetUserID())
if err != nil {
w.WriteHeader(500)
w.Write([]byte(err.Error()))
Expand Down
Loading

0 comments on commit 533bd14

Please sign in to comment.