Daya Sagar Nune


WebService::Instagram - Simple Interface to Instagram oAuth API


Version 0.03


Step 1: Get the authorization URL:

Get the AUTH URL to authenticate,

        use WebService::Instagram;

        my $instagram = WebService::Instagram->new(
                        client_id       => 'xxxxxxxxxxxxxxx',
                        client_secret   => 'xxxxxxxxxxxxxxx',
                        redirect_uri    => '',

        my $auth_url = $instagram->get_auth_url();
        print Dumper $auth_url;

Step 2: Let the User authorize the API

Go to the above calculated URL in the browser, authenticate and save the code returned by the browser after authentication. You will need this to get access_token in Step 3.

The returned URL is usually of the form

Step 3: Get and Set Access Token

Now using the code, fetch the access_token and set it to the object,

        my $access_token = $instagram->get_access_token( $code ); #$code is fetched from Step 2.

        #Set the access_token to $instagram object
        $instagram->set_access_token( $access_token );

Step 4: Fetch API Resources

Fetch the protected resource.

        #Get authenticated user's feed
        my $search_result = $instagram->get( '' );



Returns the authorization URL that the user has to authorize against. Once authorized, the browser appends the code along to the redirect URL which will used for obtaining access_token later.


Once you have the code, you are ready to get the access_token.


Since you now have the access token, you can request all the resources on behalf of the API.


Daya Sagar Nune, <dayanune at>


This module's source and other documentation is hosted at:


Copyright 2013 Daya Sagar Nune.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.