Login with instagram in grails or java application

Posted By : Shakil Pathan | 31-Dec-2015

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

 

About Author

Author Image
Shakil Pathan

Shakil is an experienced Groovy and Grails developer . He has also worked extensively on developing STB applications using NetGem .

Request for Proposal

Name is required

Comment is required

Sending message..