Skip to content

Commit

Permalink
feat(nhost_flutter_auth): Allow displayName and locale to be passed o…
Browse files Browse the repository at this point in the history
…n signInAnonymous
  • Loading branch information
sl1mpshady committed Jan 26, 2024
1 parent c263d03 commit 77010bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 8 additions & 1 deletion packages/nhost_auth_dart/lib/src/auth_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,17 @@ class NhostAuthClient implements HasuraAuthClient {
/// Nhost dashboard -> settings -> Sign in methods -> Anonymous Users
/// Throws an [NhostException] if sign in fails.
@override
Future<void> signInAnonymous() async {
Future<void> signInAnonymous(
String? displayName,
String? locale,
) async {
log.finer('Attempting sign in anonymously');
await _apiClient.post(
'/signin/anonymous',
jsonBody: {
if (displayName != null) 'displayName': displayName,
if (locale != null) 'locale': locale,
},
);
}

Expand Down
5 changes: 4 additions & 1 deletion packages/nhost_sdk/lib/src/base/hasura_auth_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ abstract class HasuraAuthClient {
String? redirectTo,
});

Future<void> signInAnonymous();
Future<void> signInAnonymous(
String? displayName,
String? locale,
);
Future<void> signInWithSmsPasswordless({
required String phoneNumber,
String? locale,
Expand Down

0 comments on commit 77010bf

Please sign in to comment.