diff --git a/v2/emailpassword/custom-ui/email-password-login.mdx b/v2/emailpassword/custom-ui/email-password-login.mdx
index de9928743..5adccfd9f 100644
--- a/v2/emailpassword/custom-ui/email-password-login.mdx
+++ b/v2/emailpassword/custom-ui/email-password-login.mdx
@@ -261,7 +261,7 @@ curl --location --request GET '^{form_apiDomain}^{form_apiBasePath}/signup/email
The response body from the API call has a `status` property in it:
-- `status: "OK"`: The response will also contain a `doesExist` boolean which will be `true` if the input email already belongs to an email password user.
+- `status: "OK"`: The response will also contain a `exists` boolean which will be `true` if the input email already belongs to an email password user.
- `status: "GENERAL_ERROR"`: This is only possible if you have overriden the backend API to send back a custom error message which should be displayed on the frontend.
diff --git a/v2/thirdparty/custom-ui/thirdparty-login.mdx b/v2/thirdparty/custom-ui/thirdparty-login.mdx
index 4c62e9242..c1efaf657 100644
--- a/v2/thirdparty/custom-ui/thirdparty-login.mdx
+++ b/v2/thirdparty/custom-ui/thirdparty-login.mdx
@@ -323,6 +323,8 @@ Coming Soon
+Step 1) Fetching the authorisation token on the frontend
+
For iOS you use the normal sign in with apple flow and then use the id token to login with SuperTokens
```swift
@@ -363,6 +365,8 @@ fileprivate class ViewController: UIViewController, ASAuthorizationControllerPre
+Step 1) Fetching the authorisation token on the frontend
+
For flutter we use the [sign_in_with_apple](https://pub.dev/packages/sign_in_with_apple) package, make sure to follow the prerequisites steps to get the package setup. After setup use the snippet below to trigger the apple sign in flow.
```dart
@@ -370,19 +374,22 @@ import 'package:sign_in_with_apple/sign_in_with_apple.dart';
void loginWithApple() async {
try {
- var credential = await SignInWithApple.getAppleIDCredential(scopes: [
- AppleIDAuthorizationScopes.email,
- AppleIDAuthorizationScopes.fullName,
- // Required for Android only
- webAuthenticationOptions: WebAuthenticationOptions(
- clientId: "",
- redirectUri: Uri.parse(
- "//callback/apple",
+ var credential = await SignInWithApple.getAppleIDCredential(
+ scopes: [
+ AppleIDAuthorizationScopes.email,
+ AppleIDAuthorizationScopes.fullName,
+ ],
+ // Required for Android only
+ webAuthenticationOptions: WebAuthenticationOptions(
+ clientId: "",
+ redirectUri: Uri.parse(
+ "//callback/apple",
+ ),
),
- ),
- ]);
+ );
String authorizationCode = credential.authorizationCode;
+ String? idToken = credential.identityToken;
String? email = credential.email;
String? firstname = credential.givenName;
String? lastName = credential.familyName;
@@ -400,6 +407,10 @@ In the snippet above for Android we need to pass an additional `webAuthenticatio
For android we also need to provide a way for the web login flow to redirect back to the app. By default the API provided by the backend SDKs redirect to the website domain you provide when initialising the SDK, we can override the API to have it redirect to our app instead. For example if you were using the Node.js SDK:
+
+
+
+
```tsx
import ^{recipeNameCapitalLetters} from "supertokens-node/recipe/^{codeImportRecipeName}";
@@ -450,6 +461,73 @@ import ^{recipeNameCapitalLetters} from "supertokens-node/recipe/^{codeImportRec
})
```
+
+
+
+
+```go
+import (
+ "net/http"
+ "strings"
+
+ "github.com/supertokens/supertokens-golang/recipe/^{codeImportRecipeName}"
+ ^{goTPModelsImport}
+ "github.com/supertokens/supertokens-golang/recipe/^{codeImportRecipeName}/^{goModelName}"
+)
+
+func main() {
+ ^{codeImportRecipeName}.Init(^{goModelNameForInit}.TypeInput{
+ Override: &^{goModelName}.OverrideStruct{
+ APIs: func(originalImplementation ^{goModelName}.APIInterface) ^{goModelName}.APIInterface {
+ originalAppleRedirectPost := *originalImplementation.AppleRedirectHandlerPOST
+
+ *originalImplementation.AppleRedirectHandlerPOST = func(formPostInfoFromProvider map[string]interface{}, options tpmodels.APIOptions, userContext *map[string]interface{}) error {
+ // formPostInfoFromProvider contains all the query params attached by Apple
+ state, stateOk := formPostInfoFromProvider["state"].(string)
+
+ queryParams := []string{}
+ if (!stateOk) || state == "" {
+ // Redirect to android app
+ for key, value := range formPostInfoFromProvider {
+ queryParams = append(queryParams, key+"="+value.(string))
+ }
+
+ queryString := ""
+ if len(queryParams) > 0 {
+ queryString = strings.Join(queryParams, "&")
+ }
+
+ // Refer to the README of sign_in_with_apple to understand what this url is
+ redirectUri := "intent://callback?" + queryString + "#Intent;package=YOUR.PACKAGE.IDENTIFIER;scheme=signinwithapple;end"
+
+ options.Res.Header().Set("Location", redirectUri)
+ options.Res.WriteHeader(http.StatusSeeOther)
+ return nil
+ } else {
+ return originalAppleRedirectPost(formPostInfoFromProvider, options, userContext)
+ }
+ }
+
+ return originalImplementation
+ },
+ },
+ ^{goSignInUpFeatureStart}
+ Providers: []tpmodels.ProviderInput{
+ // ...
+ },
+ ^{goSignInUpFeatureEnd}
+ })
+}
+```
+
+
+
+
+
+
+
+
+
In the code above we override the `appleRedirectHandlerPOST` API to check if the request was made by our Android app (You can skip checking the state if you only have a mobile app and no website). `sign_in_with_apple` requires us to parse the query params sent by apple and include them in the redirect URL in a specific way, and then we simply redirect to the deep link url. Refer to the README for `sign_in_with_apple` to read about the deep link setup required in Android.
diff --git a/v2/thirdpartyemailpassword/custom-ui/email-password-login.mdx b/v2/thirdpartyemailpassword/custom-ui/email-password-login.mdx
index 6fdc91f11..2d70f8be3 100644
--- a/v2/thirdpartyemailpassword/custom-ui/email-password-login.mdx
+++ b/v2/thirdpartyemailpassword/custom-ui/email-password-login.mdx
@@ -264,7 +264,7 @@ curl --location --request GET '^{form_apiDomain}^{form_apiBasePath}/signup/email
The response body from the API call has a `status` property in it:
-- `status: "OK"`: The response will also contain a `doesExist` boolean which will be `true` if the input email already belongs to an email password user.
+- `status: "OK"`: The response will also contain a `exists` boolean which will be `true` if the input email already belongs to an email password user.
- `status: "GENERAL_ERROR"`: This is only possible if you have overriden the backend API to send back a custom error message which should be displayed on the frontend.
diff --git a/v2/thirdpartyemailpassword/custom-ui/thirdparty-login.mdx b/v2/thirdpartyemailpassword/custom-ui/thirdparty-login.mdx
index 5e4cb1fc6..485ffe435 100644
--- a/v2/thirdpartyemailpassword/custom-ui/thirdparty-login.mdx
+++ b/v2/thirdpartyemailpassword/custom-ui/thirdparty-login.mdx
@@ -326,6 +326,8 @@ Coming Soon
+Step 1) Fetching the authorisation token on the frontend
+
For iOS you use the normal sign in with apple flow and then use the id token to login with SuperTokens
```swift
@@ -366,6 +368,8 @@ fileprivate class ViewController: UIViewController, ASAuthorizationControllerPre
+Step 1) Fetching the authorisation token on the frontend
+
For flutter we use the [sign_in_with_apple](https://pub.dev/packages/sign_in_with_apple) package, make sure to follow the prerequisites steps to get the package setup. After setup use the snippet below to trigger the apple sign in flow.
```dart
@@ -373,19 +377,22 @@ import 'package:sign_in_with_apple/sign_in_with_apple.dart';
void loginWithApple() async {
try {
- var credential = await SignInWithApple.getAppleIDCredential(scopes: [
- AppleIDAuthorizationScopes.email,
- AppleIDAuthorizationScopes.fullName,
- // Required for Android only
- webAuthenticationOptions: WebAuthenticationOptions(
- clientId: "",
- redirectUri: Uri.parse(
- "//callback/apple",
+ var credential = await SignInWithApple.getAppleIDCredential(
+ scopes: [
+ AppleIDAuthorizationScopes.email,
+ AppleIDAuthorizationScopes.fullName,
+ ],
+ // Required for Android only
+ webAuthenticationOptions: WebAuthenticationOptions(
+ clientId: "",
+ redirectUri: Uri.parse(
+ "//callback/apple",
+ ),
),
- ),
- ]);
+ );
String authorizationCode = credential.authorizationCode;
+ String? idToken = credential.identityToken;
String? email = credential.email;
String? firstname = credential.givenName;
String? lastName = credential.familyName;
@@ -403,6 +410,10 @@ In the snippet above for Android we need to pass an additional `webAuthenticatio
For android we also need to provide a way for the web login flow to redirect back to the app. By default the API provided by the backend SDKs redirect to the website domain you provide when initialising the SDK, we can override the API to have it redirect to our app instead. For example if you were using the Node.js SDK:
+
+
+
+
```tsx
import ^{recipeNameCapitalLetters} from "supertokens-node/recipe/^{codeImportRecipeName}";
@@ -453,6 +464,73 @@ import ^{recipeNameCapitalLetters} from "supertokens-node/recipe/^{codeImportRec
})
```
+
+
+
+
+```go
+import (
+ "net/http"
+ "strings"
+
+ "github.com/supertokens/supertokens-golang/recipe/^{codeImportRecipeName}"
+ ^{goTPModelsImport}
+ "github.com/supertokens/supertokens-golang/recipe/^{codeImportRecipeName}/^{goModelName}"
+)
+
+func main() {
+ ^{codeImportRecipeName}.Init(^{goModelNameForInit}.TypeInput{
+ Override: &^{goModelName}.OverrideStruct{
+ APIs: func(originalImplementation ^{goModelName}.APIInterface) ^{goModelName}.APIInterface {
+ originalAppleRedirectPost := *originalImplementation.AppleRedirectHandlerPOST
+
+ *originalImplementation.AppleRedirectHandlerPOST = func(formPostInfoFromProvider map[string]interface{}, options tpmodels.APIOptions, userContext *map[string]interface{}) error {
+ // formPostInfoFromProvider contains all the query params attached by Apple
+ state, stateOk := formPostInfoFromProvider["state"].(string)
+
+ queryParams := []string{}
+ if (!stateOk) || state == "" {
+ // Redirect to android app
+ for key, value := range formPostInfoFromProvider {
+ queryParams = append(queryParams, key+"="+value.(string))
+ }
+
+ queryString := ""
+ if len(queryParams) > 0 {
+ queryString = strings.Join(queryParams, "&")
+ }
+
+ // Refer to the README of sign_in_with_apple to understand what this url is
+ redirectUri := "intent://callback?" + queryString + "#Intent;package=YOUR.PACKAGE.IDENTIFIER;scheme=signinwithapple;end"
+
+ options.Res.Header().Set("Location", redirectUri)
+ options.Res.WriteHeader(http.StatusSeeOther)
+ return nil
+ } else {
+ return originalAppleRedirectPost(formPostInfoFromProvider, options, userContext)
+ }
+ }
+
+ return originalImplementation
+ },
+ },
+ ^{goSignInUpFeatureStart}
+ Providers: []tpmodels.ProviderInput{
+ // ...
+ },
+ ^{goSignInUpFeatureEnd}
+ })
+}
+```
+
+
+
+
+
+
+
+
+
In the code above we override the `appleRedirectHandlerPOST` API to check if the request was made by our Android app (You can skip checking the state if you only have a mobile app and no website). `sign_in_with_apple` requires us to parse the query params sent by apple and include them in the redirect URL in a specific way, and then we simply redirect to the deep link url. Refer to the README for `sign_in_with_apple` to read about the deep link setup required in Android.
diff --git a/v2/thirdpartypasswordless/custom-ui/thirdparty-login.mdx b/v2/thirdpartypasswordless/custom-ui/thirdparty-login.mdx
index e3ddfdec0..2484d2e1d 100644
--- a/v2/thirdpartypasswordless/custom-ui/thirdparty-login.mdx
+++ b/v2/thirdpartypasswordless/custom-ui/thirdparty-login.mdx
@@ -326,6 +326,8 @@ Coming Soon
+Step 1) Fetching the authorisation token on the frontend
+
For iOS you use the normal sign in with apple flow and then use the id token to login with SuperTokens
```swift
@@ -366,6 +368,8 @@ fileprivate class ViewController: UIViewController, ASAuthorizationControllerPre
+Step 1) Fetching the authorisation token on the frontend
+
For flutter we use the [sign_in_with_apple](https://pub.dev/packages/sign_in_with_apple) package, make sure to follow the prerequisites steps to get the package setup. After setup use the snippet below to trigger the apple sign in flow.
```dart
@@ -373,19 +377,22 @@ import 'package:sign_in_with_apple/sign_in_with_apple.dart';
void loginWithApple() async {
try {
- var credential = await SignInWithApple.getAppleIDCredential(scopes: [
- AppleIDAuthorizationScopes.email,
- AppleIDAuthorizationScopes.fullName,
- // Required for Android only
- webAuthenticationOptions: WebAuthenticationOptions(
- clientId: "",
- redirectUri: Uri.parse(
- "//callback/apple",
+ var credential = await SignInWithApple.getAppleIDCredential(
+ scopes: [
+ AppleIDAuthorizationScopes.email,
+ AppleIDAuthorizationScopes.fullName,
+ ],
+ // Required for Android only
+ webAuthenticationOptions: WebAuthenticationOptions(
+ clientId: "",
+ redirectUri: Uri.parse(
+ "//callback/apple",
+ ),
),
- ),
- ]);
+ );
String authorizationCode = credential.authorizationCode;
+ String? idToken = credential.identityToken;
String? email = credential.email;
String? firstname = credential.givenName;
String? lastName = credential.familyName;
@@ -403,6 +410,10 @@ In the snippet above for Android we need to pass an additional `webAuthenticatio
For android we also need to provide a way for the web login flow to redirect back to the app. By default the API provided by the backend SDKs redirect to the website domain you provide when initialising the SDK, we can override the API to have it redirect to our app instead. For example if you were using the Node.js SDK:
+
+
+
+
```tsx
import ^{recipeNameCapitalLetters} from "supertokens-node/recipe/^{codeImportRecipeName}";
@@ -453,6 +464,73 @@ import ^{recipeNameCapitalLetters} from "supertokens-node/recipe/^{codeImportRec
})
```
+
+
+
+
+```go
+import (
+ "net/http"
+ "strings"
+
+ "github.com/supertokens/supertokens-golang/recipe/^{codeImportRecipeName}"
+ ^{goTPModelsImport}
+ "github.com/supertokens/supertokens-golang/recipe/^{codeImportRecipeName}/^{goModelName}"
+)
+
+func main() {
+ ^{codeImportRecipeName}.Init(^{goModelNameForInit}.TypeInput{
+ Override: &^{goModelName}.OverrideStruct{
+ APIs: func(originalImplementation ^{goModelName}.APIInterface) ^{goModelName}.APIInterface {
+ originalAppleRedirectPost := *originalImplementation.AppleRedirectHandlerPOST
+
+ *originalImplementation.AppleRedirectHandlerPOST = func(formPostInfoFromProvider map[string]interface{}, options tpmodels.APIOptions, userContext *map[string]interface{}) error {
+ // formPostInfoFromProvider contains all the query params attached by Apple
+ state, stateOk := formPostInfoFromProvider["state"].(string)
+
+ queryParams := []string{}
+ if (!stateOk) || state == "" {
+ // Redirect to android app
+ for key, value := range formPostInfoFromProvider {
+ queryParams = append(queryParams, key+"="+value.(string))
+ }
+
+ queryString := ""
+ if len(queryParams) > 0 {
+ queryString = strings.Join(queryParams, "&")
+ }
+
+ // Refer to the README of sign_in_with_apple to understand what this url is
+ redirectUri := "intent://callback?" + queryString + "#Intent;package=YOUR.PACKAGE.IDENTIFIER;scheme=signinwithapple;end"
+
+ options.Res.Header().Set("Location", redirectUri)
+ options.Res.WriteHeader(http.StatusSeeOther)
+ return nil
+ } else {
+ return originalAppleRedirectPost(formPostInfoFromProvider, options, userContext)
+ }
+ }
+
+ return originalImplementation
+ },
+ },
+ ^{goSignInUpFeatureStart}
+ Providers: []tpmodels.ProviderInput{
+ // ...
+ },
+ ^{goSignInUpFeatureEnd}
+ })
+}
+```
+
+
+
+
+
+
+
+
+
In the code above we override the `appleRedirectHandlerPOST` API to check if the request was made by our Android app (You can skip checking the state if you only have a mobile app and no website). `sign_in_with_apple` requires us to parse the query params sent by apple and include them in the redirect URL in a specific way, and then we simply redirect to the deep link url. Refer to the README for `sign_in_with_apple` to read about the deep link setup required in Android.