Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to new Instagram APIs #441

Closed
martincostello opened this issue Jul 1, 2020 · 10 comments · Fixed by #461
Closed

Update to new Instagram APIs #441

martincostello opened this issue Jul 1, 2020 · 10 comments · Fixed by #461
Assignees

Comments

@martincostello
Copy link
Member

As raised in #435, Instagram has deprecated the API we have currently integrated against (copy of the announcement below).

By the end of September 2020, we will need to update the Instagram provider to use the new Basic Display API and/or Graph API so that the provider continues to work.

In the short term, users can workaround the change to the basic permission scope by changing their code to register the provider as below:

public void ConfigureServices(IServiceCollection services)
{
    services.AddAuthentication(options => { /* Authentication options */ })
            .AddInstagram(options =>
            {
                options.ClientId = "your client Id";
                options.ClientSecret = "your client secret";

                // Remove the built-in 'basic' scope
                options.Scope.Clear();
            });
}

This will remove the scope the provider registers by default:

Annoucement

UPDATE
The remaining Instagram Legacy API permission ("Basic Permission") was disabled on June 29, 2020. As of June 29, third-party apps no longer have access to the Legacy API. To avoid disruption of service to your app and business, developers previously using the Legacy API should instead rely on Instagram Basic Display API and Instagram Graph API. Please request approval for required permissions through the App Review process.

Legacy API user identifier available on Basic Display API until September 30, 2020
To assist with migration, we have temporarily made the unique user identifier from the Legacy API - ig_id - available on Basic Display API. However, the ig_id field will be deprecated on Basic Display API on September 30, 2020, so please ensure you are using other fields (e.g. the Facebook "id" field) or your own unique identifier for your users. See our developer documentation here to learn more.

User Token Generator
If you're only using the Legacy API to generate tokens in order to display your Instagram Feed on a personal website, you can use the Instagram Basic Display API's User Token Generator to continue generating tokens. The User Token Generator does not require App Review, but it will only work for your owned Instagram accounts (i.e. accounts for which you know the login credentials). Refer to the developer documentation here to learn more. If you're using the Legacy API to display multiple accounts on your website, then you must apply for permissions to Instagram Basic Display API via App Review. If you're using the Legacy API for any other use case, you must apply for permissions on the Instagram Graph API platform via App Review.

More Tips
For more guidance on getting through our App Review process, please see this blog post. For more tips and tools, check out our App Review Rejection Results Guide, Common App Review Rejection Reasons and Developer Tools page. We also encourage you to leverage the Facebook Developer Community Forum - it's a tremendously helpful resource for communicating and connecting with developers across the world.

@mateolevy
Copy link

Martin, just FYI Instagram states that their API should not be used from now on as an authentication method as noticed in: https://developers.facebook.com/docs/instagram-basic-display-api

Limitations
Authentication
Basic Instagram visualization is not an authentication solution. The data returned by the API cannot be used to authenticate users of the application or to log in to the application. If you need an authentication solution, we recommend that you use the login with Facebook.

Even though they claim that, you COULD still update the nuget to use the new API to authenticate. The problem is they now have a strict validation process to let you use their API in production which involves sending them videos explaining how are you using their API. Maybe it is time to consider deprecating the instagram OAuth nuget.

Let me know your thoughts!
Mateo

@martincostello
Copy link
Member Author

Ah, interesting. I hadn't thoroughly read the documentation yet.

If that is indeed the case that it shouldn't be used for OAuth authentication, then we probably would deprecate it. I'll make a more informed assessment when I take a look at the documentation properly.

Thanks Mateo 👍

@lukefulliton
Copy link
Contributor

My research and review of the new Instagram Basic Display APIs also confirms what @mateolevy mentioned above. It looks like the OAuth authentication for Instagram has been deprecated. Here is a helpful blog post from Facebook about this Instagram change. https://developers.facebook.com/blog/post/2020/03/10/final-reminder-Instagram-legacy-api-platform-disabled-mar-31/

Here is a quote from the blog
"Mistake #1: Your app uses Basic Display API for authenticating users".
"Tip: Make sure your app provides a login option that does not use Basic Display API, such as your own in-house login flow or Facebook Login."

Thanks ALL for the help and insight into this issue.

@martincostello
Copy link
Member Author

Just taken the time to look myself, and yep, indeed looks like OAuth with Instagram is no longer a thing.

@kevinchalet - shall I delete the Instagram provider from the code base and add something to the README to that effect that it's now deprecated and obsolete? We could also mark the NuGet package as deprecated.

@martincostello martincostello removed this from the 3.2.0 milestone Jul 3, 2020
@martincostello martincostello unpinned this issue Jul 3, 2020
@kevinchalet
Copy link
Member

kevinchalet commented Jul 3, 2020

@martincostello I'm not familiar enough with Instagram (for which I don't even have an account 😅), but if I read the link @lukefulliton shared correctly, it seems they still support OAuth 2.0 for pure authorization (which is its original role). While our handlers are generally used for authentication (well, pseudo-authentication, as OAuth 2.0 is not an authentication protocol, unlike OpenID Connect), people can also use them to perform actions on behalf of the users thanks to their SaveTokens option, which is exactly what OAuth 2.0 is made for.

Maybe we shouldn't deprecate the package but just tell folks that Instagram doesn't want them to use it as a login mechanism?

@AraHaan
Copy link

AraHaan commented Jul 9, 2020

hmm or deprecate it and warn on package consumption (on package restore / update) that they do not want it to be used as a login mechanism?

That way it ensures that they have actually read the notice clear as day.

martincostello added a commit to martincostello/AspNet.Security.OAuth.Providers that referenced this issue Jul 11, 2020
martincostello added a commit that referenced this issue Jul 11, 2020
* Add provider documentation index

Add an initial documentation index for the providers for #459.

* Link to ClientId and ClientSecret

Link to the Microsoft documentation for ClientId and ClientSecret.
Add missing github.md file.

* Link to docs from README

Link to the new docs from the README.

* Add Amazon docs

Add the Amazon provider documentation.

* Add provider-specific documentation

Add some provider-specific documentation for BattleNet through GitHub.

* Add Instagram provider documentation

Relates to #441.

* Tidy up XML documentation

Tidy up some of the XML documentation for the Discord and Instagram options.

* More provider documentation

Add docs for LinkedIn through to QQ.

* Add remaining provider documentation

Add documentation for the Reddit through Weibo providers.

* Tidy up XML documentation

Update some property documentation for consistency and clarity.

* Simplify constant usage

Add a static for SuperOfficeAuthenticationConstants to make the code lines shorter.

* Document Apple provider properties

Add documentation for the Apple provider's configuration options.

* Link to enumerations

Add links to the definition of the different enumerations.

* Fix class name

Fix incorrect class name being used.

* Update index

Add the required/optional values for all providers.

* Minor docs tidy-up

Format string constants as strings.
Add link to enum.

* Fix typo

Use the right kind of apostrophe.

* Link to OAuthOptions

Add a link to the OAuthOptions class.
martincostello added a commit to martincostello/AspNet.Security.OAuth.Providers that referenced this issue Jul 11, 2020
Update the Instagram provider to use the Basic Display API.
See aspnet-contrib#441.
@martincostello
Copy link
Member Author

See #461 for updates to the provider.

I have also added some documentation for the Instagram provider here.

@martincostello martincostello linked a pull request Jul 11, 2020 that will close this issue
martincostello added a commit that referenced this issue Jul 15, 2020
Update the Instagram provider to use the Basic Display API.
See #441.
@Mike-E-angelo
Copy link
Contributor

Hi all... looking into this. And I am so very confused. 😅 I did see that it's deprecated, but the Instagram Display API Application that is created has the look and feel of an Oauth2 application, complete with callback URIs and the lot.

Additionally, the endpoints still all work. Although, I am getting a 400 error with invalid scopes message when I use it (that's what led me here):

{"error_type": "OAuthException", "code": 400, "error_message": "Invalid scope: []"}

If the API is not meant for authentication, why does it still have these endpoints and all the configuration fixings for it? Thank you for any clarification/insight you can provide. Facebook-based support is abysmally absent and is nearly impossible to find answers anywhere. Sort of shocking when you consider the scale/size of the organization.

@martincostello
Copy link
Member Author

The short answer is that I don't know.

I haven't used the provider beyond testing the changes for the previous deprecation worked. Maybe Instagram have changed something that means that a scope of some kind is required?

You'd have to consult the documentation they provide to see what's changed.

With so many providers, we can't keep up to date with them all as the services evolve over time, particularly the ones we don't use in our own projects. For example, I only personally use the Amazon, Apple, GitHub and Okta providers.

@Mike-E-angelo
Copy link
Contributor

With so many providers, we can't keep up to date with them all as the services evolve over time

I totally get that @martincostello, thank you for your reply here. I am feeling a little overwhelmed with the number of providers I have implemented, myself. 😅 I did a bunch of searching for the 400 error before posting on here, but it was an interesting find here that the package was almost deprecated. All the pieces seem to be there, but this weird scope error. I will continue searching. Thank you again for the assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

6 participants