Add an add_authorization api func.
Fix the authorized check.