getToken function

Future getToken()

for getting access token

Implementation

Future getToken() async {
  if (initializedClientID.isEmpty || initializedClientSecretKey.isEmpty) {
    throw Exception(errk);
  }
  final data = {
    'client_id': initializedClientID,
    'client_secret': initializedClientSecretKey,
    'scope': ApiKeys.scope,
    'grant_type': ApiKeys.grantType,
  };
  final res = await http.post(Uri.parse(ApiKeys.tokenEndpoint), body: data);
  accessToken = json.decode(res.body)['access_token'];
}