How to restrict rest api scope access

Load OauthLibrary first

$this->load->library( 'OauthLibrary' );
if( ! $this->oauthlibrary->checkScope( 'core' ) ) {
	 // display json forbidden error
}

checkScope returns bool.