get_token_from_code function

Future<String> get_token_from_code(
  1. String code
)

Implementation

Future<String> get_token_from_code(String code) async {
  var client = Dio();
  var response = await client.post(
    auth_token_endpoint,
    data: {
      'client_id': APP_ID,
      'scope': scope,
      'code': code,
      'redirect_uri': redirect_url,
      'grant_type': 'authorization_code',
      // 'client_secret': APP_SECRET,
    },
  );
  var token = response.data['access_token'];
  return token;
}