omniauth / omniauth-instagram

OmniAuth strategy for Instagram.
111 stars 84 forks source link

Getting access_denied | The user denies your request while I accept the request #40

Open mathieubrunpicard opened 5 years ago

mathieubrunpicard commented 5 years ago

Hey guys,

I am currently trying to set a OAuth connexion via Instagram and I found this gem. I successfully plugged it for Facebook, linkedin and Google + but I am currently struggling with Instagram connexion.

The reason is that I get this error when I click on "Authorize" on the Instagram connexion page

ERROR -- omniauth: (instagram) Authentication failure! user_denied: OmniAuth::Strategies::OAuth2::CallbackError, access_denied | The user denied your request.

I hence get redirect to my failure method:

Parameters: {"error_reason"=>"user_denied", "error"=>"access_denied", "error_description"=>"The user denied your request.", "state"=>"d54f932ff4bada3abd784e39886b96d324f753929d410d97"}

Here is how I configured my provider in my devise.rb file :

config.omniauth :instagram, instagram_id, instagram_secret, {
    scope: "basic"
  }

Nothing fancy going on here. Here are the version of the gems that I am using :

omniauth-instagram (1.3.0)
      omniauth (~> 1)
      omniauth-oauth2 (~> 1)

I tried looking it up but I couldn't find any related solutions.

Thanks for your feedback

mrjamesriley commented 5 years ago

Hello,

We've been seeing the shame issue. Shockingly it appears to be an issue when the authorisation screen at Instagram is anything but English. See the following:

https://twitter.com/vdwijngaert/status/1112999130878619649 https://developers.facebook.com/support/bugs/1766879903442787/

The solution appears to be:

Appending the undocumented suffix "&hl=en" to the auth url also works as a fix, as it changes the language to English. Might be useful for non-tech users.

Will report back once we've confirmed it as working! 👍

UPDATE

The solution we've gone with is to set the hl=en in the config.omniauth, e.g:

config.omniauth :instagram, INSTAGRAM_APP_ID, INSTAGRAM_APP_SECRET, scope: 'basic', authorize_params: { hl: 'en' }