Skip to content

Tiltify/ueberauth_mailchimp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Überauth Mailchimp

Mailchimp OAuth2 strategy for Überauth.

Installation

  1. Setup your application at Mailchimp API.

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

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

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

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

    config :ueberauth, Ueberauth.Strategy.Mailchimp.OAuth,
      client_id: System.get_env("MAILCHIMP_CLIENT_ID"),
      client_secret: System.get_env("MAILCHIMP_CLIENT_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/mailchimp

Or with options:

/auth/mailchimp?scope=users:read

By default the requested scope is "users:read". Scope can be configured either explicitly as a scope query value on the request path or in your configuration:

config :ueberauth, Ueberauth,
  providers: [
    mailchimp: {Ueberauth.Strategy.Mailchimp, [default_scope: "users:read,users:write"]}
  ]

License

Please see LICENSE for licensing details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages