Flickr is switching to OAuth exclusively after July 31, 2012. It currently supports its own authentication in parallel with OAuth. So this module should transition to using OAuth before July 31.

It seems reasonably straightforward. I'm happy to take this on if I find some time. For the moment, it's up for the taking. If anyone else codes it up, please be aware of some other unintegrated auth-related patches I've made recently which have not been reviewed. Quiet little module, this one.

This issue applies to all versions. Seems to be no way to indicate that elegantly.

CommentFileSizeAuthor
#5 oauth.png25.01 KBBarisW

Comments

hughbris’s picture

Issue summary: View changes

Borked link markup, sorry

BarisW’s picture

Hi Hugh,

thanks for posting this. Did you happen to be working on this? If not, I'll have a look.
I've just rolled a new 7.x-1.2 release; please work on the current dev as I've implemented the 3.1 version of the Flickr API as well.

Thanks a lot!

BarisW’s picture

Priority: Normal » Major

May I suggest to not re-invent the wheel but use the OAuth module as dependency and only write integration with that module? If anyone knows how to implement it; please do.

Because FlickrAPI 3.1 (the latest version) has no implementation with OAuth authentication, I think we need to override the current class to change the auth() function. Like this:

<?php
/**
 * Implementation of our own class flickrapiPhpFlickr to override the default phpFlickr class.
 * We need to do this because phpFlickr has no implementation of OAuth authentication.
 */
class flickrapiPhpFlickr extends phpFlickr {
  function auth ($perms = "read", $remember_uri = true) {
    // Redirects to Flickr's authentication piece if there is no valid token.
    // If remember_uri is set to false, the callback script (included) will
    // redirect to its default page.

    if (empty($_SESSION['phpFlickr_auth_token']) && empty($this->token)) {
      if ( $remember_uri === true ) {
        $_SESSION['phpFlickr_auth_redirect'] = $_SERVER['REQUEST_URI'];
      } elseif ( $remember_uri !== false ) {
        $_SESSION['phpFlickr_auth_redirect'] = $remember_uri;
      }
      
      // Add OAuth integration here.

      exit;
    } else {
      $tmp = $this->die_on_error;
      $this->die_on_error = false;
      $rsp = $this->auth_checkToken();
      if ($this->error_code !== false) {
        unset($_SESSION['phpFlickr_auth_token']);
        $this->auth($perms, $remember_uri);
      }
      $this->die_on_error = $tmp;
      return $rsp['perms'];
    }
  }
}
?>

As you can see, the hardest part (<?php // Add OAuth integration here. ?>) still has to be taken care of.

BarisW’s picture

I managed to integrate the OAuth module and implement the authorization flow in the FlickAPI admin settings page. The only thing left now is to change the way Flickr is called (http://www.flickr.com/services/api/auth.oauth.html#call_api).

Will be continued.

BarisW’s picture

Status: Active » Fixed

Committed.

BarisW’s picture

StatusFileSize
new25.01 KB

I even added some nice icons ;)

oauth.png

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Borked apostrophe, sorry :%