diff --git a/v2/emailpassword/custom-ui/handling-session-tokens.mdx b/v2/emailpassword/custom-ui/handling-session-tokens.mdx index e320a4e7c..e5dbefe74 100644 --- a/v2/emailpassword/custom-ui/handling-session-tokens.mdx +++ b/v2/emailpassword/custom-ui/handling-session-tokens.mdx @@ -203,6 +203,83 @@ fileprivate class NetworkManager { By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. ::: +### For Flutter + + + + +You can make requests as you normally would with `http`, the only difference is that you import the client from the supertokens package instead. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + var response = await http.get(uri); + // handle response +} +``` + +

Using a custom http client

+ +If you use a custom http client and want to use SuperTokens, you can simply provide the SDK with your client. All requests will continue to use your client along with the session logic that SuperTokens provides. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + + // provide your custom client to SuperTokens + var httpClient = http.Client(client: customClient) + + var response = await httpClient.get(uri); + // handle response +} +``` + +
+ + +

Add the SuperTokens interceptor

+ +Use the extension method provided by the SuperTokens SDK to enable interception on your Dio client. This allows the SuperTokens SDK to handle session tokens for you. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(); // Create a Dio instance. + dio.addSupertokensInterceptor(); +} +``` + +

Making network requests

+ +You can make requests as you normally would with `dio`. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(...) + dio.addSupertokensInterceptor(); + + var response = dio.get("http://localhost:3001/api"); + // handle response +} +``` + +
+
+ +:::note +By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. +::: + ## If not using our frontend SDK :::caution diff --git a/v2/passwordless/custom-ui/handling-session-tokens.mdx b/v2/passwordless/custom-ui/handling-session-tokens.mdx index e320a4e7c..e5dbefe74 100644 --- a/v2/passwordless/custom-ui/handling-session-tokens.mdx +++ b/v2/passwordless/custom-ui/handling-session-tokens.mdx @@ -203,6 +203,83 @@ fileprivate class NetworkManager { By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. ::: +### For Flutter + + + + +You can make requests as you normally would with `http`, the only difference is that you import the client from the supertokens package instead. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + var response = await http.get(uri); + // handle response +} +``` + +

Using a custom http client

+ +If you use a custom http client and want to use SuperTokens, you can simply provide the SDK with your client. All requests will continue to use your client along with the session logic that SuperTokens provides. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + + // provide your custom client to SuperTokens + var httpClient = http.Client(client: customClient) + + var response = await httpClient.get(uri); + // handle response +} +``` + +
+ + +

Add the SuperTokens interceptor

+ +Use the extension method provided by the SuperTokens SDK to enable interception on your Dio client. This allows the SuperTokens SDK to handle session tokens for you. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(); // Create a Dio instance. + dio.addSupertokensInterceptor(); +} +``` + +

Making network requests

+ +You can make requests as you normally would with `dio`. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(...) + dio.addSupertokensInterceptor(); + + var response = dio.get("http://localhost:3001/api"); + // handle response +} +``` + +
+
+ +:::note +By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. +::: + ## If not using our frontend SDK :::caution diff --git a/v2/session/quick-setup/handling-session-tokens.mdx b/v2/session/quick-setup/handling-session-tokens.mdx index e320a4e7c..e5dbefe74 100644 --- a/v2/session/quick-setup/handling-session-tokens.mdx +++ b/v2/session/quick-setup/handling-session-tokens.mdx @@ -203,6 +203,83 @@ fileprivate class NetworkManager { By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. ::: +### For Flutter + + + + +You can make requests as you normally would with `http`, the only difference is that you import the client from the supertokens package instead. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + var response = await http.get(uri); + // handle response +} +``` + +

Using a custom http client

+ +If you use a custom http client and want to use SuperTokens, you can simply provide the SDK with your client. All requests will continue to use your client along with the session logic that SuperTokens provides. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + + // provide your custom client to SuperTokens + var httpClient = http.Client(client: customClient) + + var response = await httpClient.get(uri); + // handle response +} +``` + +
+ + +

Add the SuperTokens interceptor

+ +Use the extension method provided by the SuperTokens SDK to enable interception on your Dio client. This allows the SuperTokens SDK to handle session tokens for you. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(); // Create a Dio instance. + dio.addSupertokensInterceptor(); +} +``` + +

Making network requests

+ +You can make requests as you normally would with `dio`. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(...) + dio.addSupertokensInterceptor(); + + var response = dio.get("http://localhost:3001/api"); + // handle response +} +``` + +
+
+ +:::note +By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. +::: + ## If not using our frontend SDK :::caution diff --git a/v2/src/plugins/codeTypeChecking/dart_env/pubspec.lock b/v2/src/plugins/codeTypeChecking/dart_env/pubspec.lock index f8c6388d5..1c39a5a8e 100644 --- a/v2/src/plugins/codeTypeChecking/dart_env/pubspec.lock +++ b/v2/src/plugins/codeTypeChecking/dart_env/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.17.1" + version: "1.17.2" cupertino_icons: dependency: "direct main" description: @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: dio - sha256: "7d328c4d898a61efc3cd93655a0955858e29a0aa647f0f9e02d59b3bb275e2e8" + sha256: "417e2a6f9d83ab396ec38ff4ea5da6c254da71e4db765ad737a42af6930140b7" url: "https://pub.dev" source: hosted - version: "4.0.6" + version: "5.3.3" fake_async: dependency: transitive description: @@ -188,18 +188,18 @@ packages: dependency: transitive description: name: matcher - sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.15" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.5.0" meta: dependency: transitive description: @@ -212,10 +212,10 @@ packages: dependency: transitive description: name: mutex - sha256: "03116a4e46282a671b46c12de649d72c0ed18188ffe12a8d0fc63e83f4ad88f4" + sha256: "8827da25de792088eb33e572115a5eb0d61d61a3c01acbc8bcbe76ed78f1a1f2" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.1.0" path: dependency: transitive description: @@ -369,10 +369,10 @@ packages: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" stack_trace: dependency: transitive description: @@ -401,10 +401,10 @@ packages: dependency: "direct main" description: name: supertokens_flutter - sha256: "527599059e983f2c8bfef1907bb6716f3a9d646acc3221ae3f1008c46ce8e7da" + sha256: d03f0223f1c7485690ee7a2c864144ab5bbcc814961fe551d0c50278cad9af87 url: "https://pub.dev" source: hosted - version: "0.2.2" + version: "0.3.0" term_glyph: dependency: transitive description: @@ -417,10 +417,10 @@ packages: dependency: transitive description: name: test_api - sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.6.0" typed_data: dependency: transitive description: @@ -437,6 +437,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + web: + dependency: transitive + description: + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + url: "https://pub.dev" + source: hosted + version: "0.1.4-beta" win32: dependency: transitive description: @@ -454,5 +462,5 @@ packages: source: hosted version: "0.2.0+3" sdks: - dart: ">=3.0.0-0 <3.9.0" + dart: ">=3.1.0-185.0.dev <3.9.0" flutter: ">=3.7.6" diff --git a/v2/src/plugins/codeTypeChecking/dart_env/pubspec.yaml b/v2/src/plugins/codeTypeChecking/dart_env/pubspec.yaml index 01982648e..bbae8d3de 100644 --- a/v2/src/plugins/codeTypeChecking/dart_env/pubspec.yaml +++ b/v2/src/plugins/codeTypeChecking/dart_env/pubspec.yaml @@ -35,7 +35,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 - supertokens_flutter: ^0.2.2 + supertokens_flutter: ^0.3.0 google_sign_in: ^6.1.4 sign_in_with_apple: ^5.0.0 diff --git a/v2/thirdparty/custom-ui/handling-session-tokens.mdx b/v2/thirdparty/custom-ui/handling-session-tokens.mdx index e320a4e7c..e5dbefe74 100644 --- a/v2/thirdparty/custom-ui/handling-session-tokens.mdx +++ b/v2/thirdparty/custom-ui/handling-session-tokens.mdx @@ -203,6 +203,83 @@ fileprivate class NetworkManager { By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. ::: +### For Flutter + + + + +You can make requests as you normally would with `http`, the only difference is that you import the client from the supertokens package instead. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + var response = await http.get(uri); + // handle response +} +``` + +

Using a custom http client

+ +If you use a custom http client and want to use SuperTokens, you can simply provide the SDK with your client. All requests will continue to use your client along with the session logic that SuperTokens provides. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + + // provide your custom client to SuperTokens + var httpClient = http.Client(client: customClient) + + var response = await httpClient.get(uri); + // handle response +} +``` + +
+ + +

Add the SuperTokens interceptor

+ +Use the extension method provided by the SuperTokens SDK to enable interception on your Dio client. This allows the SuperTokens SDK to handle session tokens for you. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(); // Create a Dio instance. + dio.addSupertokensInterceptor(); +} +``` + +

Making network requests

+ +You can make requests as you normally would with `dio`. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(...) + dio.addSupertokensInterceptor(); + + var response = dio.get("http://localhost:3001/api"); + // handle response +} +``` + +
+
+ +:::note +By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. +::: + ## If not using our frontend SDK :::caution diff --git a/v2/thirdpartyemailpassword/custom-ui/handling-session-tokens.mdx b/v2/thirdpartyemailpassword/custom-ui/handling-session-tokens.mdx index e320a4e7c..e5dbefe74 100644 --- a/v2/thirdpartyemailpassword/custom-ui/handling-session-tokens.mdx +++ b/v2/thirdpartyemailpassword/custom-ui/handling-session-tokens.mdx @@ -203,6 +203,83 @@ fileprivate class NetworkManager { By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. ::: +### For Flutter + + + + +You can make requests as you normally would with `http`, the only difference is that you import the client from the supertokens package instead. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + var response = await http.get(uri); + // handle response +} +``` + +

Using a custom http client

+ +If you use a custom http client and want to use SuperTokens, you can simply provide the SDK with your client. All requests will continue to use your client along with the session logic that SuperTokens provides. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + + // provide your custom client to SuperTokens + var httpClient = http.Client(client: customClient) + + var response = await httpClient.get(uri); + // handle response +} +``` + +
+ + +

Add the SuperTokens interceptor

+ +Use the extension method provided by the SuperTokens SDK to enable interception on your Dio client. This allows the SuperTokens SDK to handle session tokens for you. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(); // Create a Dio instance. + dio.addSupertokensInterceptor(); +} +``` + +

Making network requests

+ +You can make requests as you normally would with `dio`. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(...) + dio.addSupertokensInterceptor(); + + var response = dio.get("http://localhost:3001/api"); + // handle response +} +``` + +
+
+ +:::note +By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. +::: + ## If not using our frontend SDK :::caution diff --git a/v2/thirdpartypasswordless/custom-ui/handling-session-tokens.mdx b/v2/thirdpartypasswordless/custom-ui/handling-session-tokens.mdx index e320a4e7c..e5dbefe74 100644 --- a/v2/thirdpartypasswordless/custom-ui/handling-session-tokens.mdx +++ b/v2/thirdpartypasswordless/custom-ui/handling-session-tokens.mdx @@ -203,6 +203,83 @@ fileprivate class NetworkManager { By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. ::: +### For Flutter + + + + +You can make requests as you normally would with `http`, the only difference is that you import the client from the supertokens package instead. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + var response = await http.get(uri); + // handle response +} +``` + +

Using a custom http client

+ +If you use a custom http client and want to use SuperTokens, you can simply provide the SDK with your client. All requests will continue to use your client along with the session logic that SuperTokens provides. + +```dart +// Import http from the SuperTokens package +import 'package:supertokens_flutter/http.dart' as http; + +Future makeRequest() { + Uri uri = Uri.parse("http://localhost:3001/api"); + + // provide your custom client to SuperTokens + var httpClient = http.Client(client: customClient) + + var response = await httpClient.get(uri); + // handle response +} +``` + +
+ + +

Add the SuperTokens interceptor

+ +Use the extension method provided by the SuperTokens SDK to enable interception on your Dio client. This allows the SuperTokens SDK to handle session tokens for you. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(); // Create a Dio instance. + dio.addSupertokensInterceptor(); +} +``` + +

Making network requests

+ +You can make requests as you normally would with `dio`. + +```dart +import 'package:supertokens_flutter/dio.dart'; + +void setup() { + Dio dio = Dio(...) + dio.addSupertokensInterceptor(); + + var response = dio.get("http://localhost:3001/api"); + // handle response +} +``` + +
+
+ +:::note +By default our mobile SDKs use a bearer token in the Authorization header to provide credentials. +::: + ## If not using our frontend SDK :::caution