authenticateFacebook method
Future<Session>
authenticateFacebook({
- required String token,
- bool create = true,
- String? username,
- Map<
String, String> ? vars, - bool import = false,
override
#Facebook authentication
Nakama Facebook Authentication is an easy to use authentication method which lets you optionally import the player’s Facebook friends and add them to their Nakama Friends list.
Set import
to true
to import friends from the user's facebook account.
Implementation
@override
Future<model.Session> authenticateFacebook({
required String token,
bool create = true,
String? username,
Map<String, String>? vars,
bool import = false,
}) async {
final res = await _api.v2AccountAuthenticateFacebookPost(
body: ApiAccountFacebook(
token: token,
vars: vars,
),
$sync: import,
create: create,
username: username,
);
if (res.body == null) {
throw Exception('Authentication failed.');
}
final data = res.body!;
return model.Session.fromApi(data);
}