how to handle CHybridAuth – Oophs. Error! – access denied

When you make the user login to your website via a social network like facebook and the user is directed by CHybridAuth to the social network (facebook). Then the user has two choices to either allow or cancel the access to your app. If the user happens to cancel the access then the class Endpoint in CHybridAuth throws an exception (like Oophs. Error! – access denied ) which is not useful for users and looks not so nice.

To handle this I simply added the following code to actionEndpoint:

  // my updated version of actionEndpoint()
  public function actionEndpoint(){
    if (isset($_GET['error']) && $_GET['error']=='access_denied') {
    	throw new CHttpException(403,'Access denied');

This has been implemented on site

Leave a Reply

Your email address will not be published. Required fields are marked *