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 apiPath = '/account/sessions/anonymous';

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

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

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

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