Überauth Khan Academy
Khan Academy strategy for Überauth.
Note: Sessions are required for this strategy.
Source code is available on Github.
Installation
Create an application at Flickr App Garden.
Add
:ueberauth_flickrto your list of dependencies inmix.exs:def deps do[{:ueberauth_flicker, "~> 0.2"}]endAdd the strategy to your applications:
def application do[applications: [:ueberauth_flickr]]endAdd Flickr to your Überauth configuration:
config :ueberauth, Ueberauth,providers: [flickr: {Ueberauth.Strategy.Flickr, []}]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")Include the Überauth plug in your controller:
defmodule MyApp.AuthController douse MyApp.Web, :controllerpipeline :browser doplug Ueberauth...endendCreate the request and callback routes if you haven't already:
scope "/auth", MyApp dopipe_through :browserget "/:provider", AuthController, :requestget "/:provider/callback", AuthController, :callbackendYour controller needs to implement callbacks to deal with
Ueberauth.AuthandUeberauth.Failureresponses.
For an example implementation see the Überauth Example application.
Calling
Depending on the configured url you can initial 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.