Updated strategy according to OAuth2 protocol.

* updated strategy.js
* fixed tests
Added custom errors.
Added some tests.