getUserProfile method

Future getUserProfile (
  1. String token
)

Gets the users profile from the token @param token The session token, which you got, when the user has been authorized.

Implementation

dynamic getUserProfile(String token) async {
  if (token == null) {
    throw new sCNotify("Please define a token as the first parameter.", sCNotifyTypes.ERROR);
  }

  var client = new http.Client();
  try {
    Map<String, String> headers = {
      'appid': _app_id,
      'appsecret': _app_secret,
      'authtoken': token
    };

    return await client.get(config.api_endpoint + "?function=user_profile",
      headers: headers
    );

  } catch(e) {
    return e;
  } finally {
    client.close();
  }
}