Add more grant types to version 2

* Add config param grant_type
* Split _authorize into _authorize_implicit and _authorize_client_credentials
* Fix some minor bugs with wrong variable names and global/undefined vars.