Überauth Stripe

![Build Status][travis-img]][travis] [![Hex Version][hex-img]][hex] [![License][license-img]

Stripe OAuth2 strategy for Überauth.

Installation

  1. Setup your application at Stripe Connect.

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

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

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

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

    config :ueberauth, Ueberauth.Strategy.Stripe.OAuth,
      client_id: System.get_env("STRIPE_CLIENT_ID")
      client_secret: System.get_env("STRIPE_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 initialize the request through:

/auth/stripe

Or with options:

/auth/stripe?scope=read_write

By default the requested scope is “read_only”, if you want to make charges on behalf of the connected app you need to request “read_write”. Scope can be configured either explicitly as a scope query value on the request path or in your configuration:

config :ueberauth, Ueberauth,
  providers: [
    stripe: {Ueberauth.Strategy.Stripe, [default_scope: "read_write"]}
  ]

Additionally you can now specify the display param to pass to Stripe:

config :ueberauth, Ueberauth,
  providers: [
    stripe: {Ueberauth.Strategy.Stripe, [
      default_scope: "read_write",
      display: "popup"
    ]}
  ]

display can be the following values: page (default), async, iframe, popup, touch, wap

License

Please see LICENSE for licensing details.

Developed by Crystal Helix Inc