Überauth Stripe
![Build Status][travis-img]][travis] [![Hex Version][hex-img]][hex] [![License][license-img]
Stripe OAuth2 strategy for Überauth.
Installation
Setup your application at Stripe Connect.
Add
:ueberauth_stripe
to your list of dependencies inmix.exs
:def deps do [{:ueberauth_stripe, "~> 0.1"}] end
Add the strategy to your applications:
def application do [applications: [:ueberauth_stripe]] end
Add Stripe to your Überauth configuration:
config :ueberauth, Ueberauth, providers: [ stripe: {Ueberauth.Strategy.Stripe, []} ]
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")
Include the Überauth plug in your controller:
defmodule MyApp.AuthController do use MyApp.Web, :controller plug Ueberauth ... end
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
Your controller needs to implement callbacks to deal with
Ueberauth.Auth
andUeberauth.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