Hi,

I've written something I think is syntactically correct and should work, but I dont understand authentication and I would appreciate shortcuts :D

My code which is currently returns 403 as expected with a fake registration

#!/usr/bin/perl -- use strict; use warnings; use Imgur::API; use Data::Dump qw/ dd /; use Carp::Always; my $key = shift or die "key"; my $file = shift or die "folder/folder/file"; # my $imgur = Imgur::API->new( api_key => $key ); # Missing required arguments: client_id at (eval 28) line 45. my $imgur = Imgur::API->new( client_id => $key ); # die # dd( $imgur ); # dd( $imgur->ua ); $imgur->ua->add_handler("request_send", sub { shift->dump; return }); $imgur->ua->add_handler("response_done", sub { shift->dump; return }); ################################ # ?? oauth login stuff here ??? ######################################################## my $img = $imgur->image->upload( image => $imgur->content( $file ), title => $file, description => $file, # album => "my files 1", ## ??? folder/folder/ ???? ); dd( $img ); print join "\n", $file, bblinkimg( $img ), "\n"; print join "\n", $file, dellink( $img ), "\n"; dd( $imgur ); my $ret = $imgur->image->delete( $img->deletehash ); dd( $ret ); exit( 0 ); sub bblinkimg { my( $img ) = @_; return sprintf '[url="%s"][img]htttp://i.imgur.com/%sl.jpg[/img][/url]', $img->link, $img->id, ; } sub dellink { my( $img ) = @_; return sprintf '# https://imgur.com/delete/%s', $img->deletehash, $img->id, ; }

Speaking of oauth , I'm about to register an app, what do I choose?

(*) OAuth 2 with callback url

( ) OAuth 2 without callback url

( ) Anonymous usage without user authorization

I suspect its option number 2 cause this will be a cli app not a web app, but its extremely new to me and I would appreciate a quickstart or baby instructions :)


In reply to Re^4: Upload image to Imgur and retrieve the link/embed bbcode by Anonymous Monk
in thread Upload image to Imgur and retrieve the link/embed bbcode by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.