Instagram API: do scopes work with OAuth2 implicit authentication flow?

烈酒焚心 提交于 2019-11-29 01:57:04

I just tried with implicit oauth flow with my client_id and scope=basic+likes and it worked. Replace the url below with your client_id and redirect_uri, and try.

https://instagram.com/oauth/authorize/?client_id=CLIENT_ID&redirect_uri=REDIRECT-URI&response_type=token&scope=basic+likes

May be Instagram is not allowing scope other than basic with new client accounts...

The answer here is that YES, scopes can be requested by implicit auth flow just fine. My problem was related to an OAuth component that I was using. The component was silently URL-encoding the value of the scope param, which was rejected by the Instagram auth endpoint. I updated the component (Xamarin.Auth) to accomodate a non-encoded scope param and issued a pull request.

Thanks to @krisak for providing a working URL that I could test.

So I had similar issues regarding the encoding of the + when trying to get permission for multiple scopes (basic, likes, comments). The solution I found was to use spaces between the individual scopes:

In the config/initializers/omniauth.rb file:

Rails.application.config.middleware.use OmniAuth::Builder do
    provider :instagram, 'TOKEN', 'SECRETKEY' , {:scope => "basic likes comments"}
end

Unfortunately starting from April 14th 2015 new clients cannot get access for any scope but basic. Official message could be found at the client configuration page:

Starting April 14th 2015, new clients need to request access to be able to post likes, follows, and comments. For more information please read the Developer Blog at http://developers.instagram.com.

The message refers following blog entry: http://developers.instagram.com/post/116410697261/publishing-guidelines-and-signed-requests

Instagram requires personal request to be sent to enable scopes for your application (client ID), but your app has to meet certain conditions described in the blog entry.

i have the same problem i found this solution and works fine

Go to Manage clients under instagram/developer. Then click edit under your app and uncheck Disable Implicit OAuth. It will now work as intended.

Instragram changed this for a reason though, so should probably think twice before going public with your app: http://instagram.com/developer/restrict-api-requests/

At this time, May 2015, YES.

As explained on instagram documentation about authentication:

The Instagram API uses the OAuth 2.0 protocol for simple, but effective authentication and authorization. OAuth 2.0 is much easier to use than previous schemes and developers can start using the Instagram API almost immediately. The one thing to keep in mind is that all requests to the API must be made over SSL (https:// not http://).

You first need to register your app here and then, with CLIENT ID provided by instagram, you can do this request:

https://api.instagram.com/oauth/authorize/?client_id=CLIENT-ID&redirect_uri=REDIRECT-URI&response_type=code

Where you have to put your client_id and redirect_uri.

Just for information, in redirect_uri field you can insert also

http://localhost

you must be add "+" between scopes like that is "basic+comments+follower_list+likes+public_content+relationships"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!