In the previous post I had a small presentation about REST API. I learned how to build it and to use it but I wanted to know more. So I started looking for a new challenge and it came from Instagram API. They have a lot of endpoints to use and also an authentications process. They are using the OAuth 2 protocol. Here we can find the entire documentation for OAuth 2. In small lines the in OAuth 2 has 4 components:
- resource owner - An entity capable of granting access to a protected resource. When the resource owner is a person, it is referred to as an end-user.
- resource server - The server hosting the protected resources, capable of accepting and responding to protected resource requests using access tokens.
- client - An application making protected resource requests on behalf of the resource owner and with its authorization.
- authorization server - The server issuing access tokens to the client after successfully authenticating the resource owner and obtaining authorization.
And here is the communication between them:
After we have the token we can make the secure requests via https.
In my application I want to take the Popular Photos, My Photos and Friends Photos. To make this possible I need to connect to the next endpoints:
- Popular Photos
- My Photos:
- Friends Photos:
In the previews post we have connected to our web API service but without authentication to it. Now that we have all what we need from Instagram API we will use it from Backbone in the next Posts. Before doing this I will create a new project using ASP .NET MVC and jQuery Mobile and I will see what is actually jQuery Mobile and how I can use.