createAnonymousSession method

Future<Session> createAnonymousSession()

Create Anonymous Session

Use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its email and password or create an OAuth2 session.

Implementation

Future<models.Session> createAnonymousSession() async {
  const String path = '/account/sessions/anonymous';

  final Map<String, dynamic> params = {};

  final Map<String, String> headers = {
    'content-type': 'application/json',
  };

  final res = await client.call(HttpMethod.post,
      path: path, params: params, headers: headers);

  return models.Session.fromMap(res.data);
}