Skip to content

christopheradams/ueberauth_flickr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Überauth Flickr

Flickr strategy for Überauth.

Note: Sessions are required for this strategy.

Install the latest version of Überauth Flickr from https://hex.pm/packages/ueberauth_flickr

Documentation is available at http://hexdocs.pm/ueberauth_flickr

Source code is available at https://github.com/christopheradams/ueberauth_flickr

Installation

  1. Create an application at Flickr App Garden.

  2. Add :ueberauth_flickr to your list of dependencies in mix.exs:

    def deps do
      [{:ueberauth_flicker, "~> 0.3"}]
    end
  3. Add the strategy to your applications:

    def application do
      [applications: [:ueberauth_flickr]]
    end
  4. Add Flickr to your Überauth configuration:

    config :ueberauth, Ueberauth,
      providers: [
        flickr: {Ueberauth.Strategy.Flickr, []}
      ]
  5. Update your provider configuration:

    config :ueberauth, Ueberauth.Strategy.Flickr.OAuth,
      consumer_key: System.get_env("FLICKR_CONSUMER_KEY"),
      consumer_secret: System.get_env("FLICKR_CONSUMER_SECRET")
  6. Include the Überauth plug in your controller:

    defmodule MyApp.AuthController do
      use MyApp.Web, :controller
    
      plug Ueberauth
    end
  7. Create the request and callback routes if you haven't already:

    scope "/auth", MyApp do
      pipe_through :browser
    
      get "/:provider", AuthController, :request
      get "/:provider/callback", AuthController, :callback
    end
  8. Your controller needs to implement callbacks to deal with Ueberauth.Auth and Ueberauth.Failure responses.

For an example implementation see the Überauth Example application.

Calling

Depending on the configured url you can initiate the request through:

/auth/flickr

Or with options:

/auth/flickr?perms=delete

By default the permissions are the ones defined in your application authentication flow on Flickr. To override them, set a perms query value on the request path or in your configuration. Allowed values are "read", "write", or "delete".

config :ueberauth, Ueberauth,
  providers: [
    flickr: {Ueberauth.Strategy.Flickr, [default_perms: "delete"]}
  ]

License

Please see LICENSE for licensing details.