Hi,
In this blog, I'm going to explain you about how to use instagram api end points for implementing login with instagram in your grails or java application.
In one of my recent project, I have to implement login with instagram.
For getting the access token we have used javascript client apis and then used this access token for getting the user information.
For getting the user access token we have to make instagram developer application. It gives you the consumer key and consumer secret for your application which is used at client side for getting the user access token.
Now, below is the sever side code that I have used for getting the user information from instagram api end points:
def httpBuilder = new HTTPBuilder('https://api.instagram.com/v1/users/self?access_token=' + accessToken) httpBuilder.request( groovyx.net.http.Method.GET ) { response.success = { resp, json -> instaProfileDetails.name = json.data.full_name instaProfileDetails.email = json.data.username instaProfileDetails.photoUrl = json.data.profile_picture instaProfileDetails.uid = json.data.id } }
For getting the user details the above api is used, which requires user access token and returns user details in json format, which you can parse and use that in your application.
Hope it helps!
Thanks
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Shakil Pathan
Shakil is an experienced Groovy and Grails developer . He has also worked extensively on developing STB applications using NetGem .