Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add saveSession option in goture_client signUp method #1053

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/gotrue/lib/src/gotrue_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ class GoTrueClient {
/// [data] sets [User.userMetadata] without an extra call to [updateUser]
///
/// [channel] Messaging channel to use (e.g. whatsapp or sms)
///
/// [saveSession] save the user session after signUp
Future<AuthResponse> signUp({
String? email,
String? phone,
Expand All @@ -198,6 +200,7 @@ class GoTrueClient {
Map<String, dynamic>? data,
String? captchaToken,
OtpChannel channel = OtpChannel.sms,
bool saveSession = true,
}) async {
assert((email != null && phone == null) || (email == null && phone != null),
'You must provide either an email or phone number');
Expand Down Expand Up @@ -252,7 +255,7 @@ class GoTrueClient {
final authResponse = AuthResponse.fromJson(response);

final session = authResponse.session;
if (session != null) {
if (session != null && saveSession) {
_saveSession(session);
notifyAllSubscribers(AuthChangeEvent.signedIn);
}
Expand Down
Loading