Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not open pop-up oAuth authentication in backbone

I'm using this great library to make oauth authentication :

https://oauth.io/docs/mobiles

and by this code (written in router function) :

OAuth.initialize('FUxf14**YBrE');
//Using popup (option 1)
  OAuth.popup('instagram', function(error, result) {
    //handle error with error
    //use result.access_token in your API request
      console.log(error);
  });

This code should open a pop-up but console.log(error) tell me:

message: "Could not open a popup"

Why it can't open a pop-up?

like image 527
Stefano Maglione Avatar asked Jan 24 '26 17:01

Stefano Maglione


1 Answers

The popup is probably blocked by the browser.

To prevent that, make the call to OAuth.popup only inside a click event handler.

like image 113
Andrey Mikhaylov - lolmaus Avatar answered Jan 27 '26 05:01

Andrey Mikhaylov - lolmaus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!