1

EDIT: Resolved this issue. Ended up being trivial; I forgot to restart the Rails server after editing my config file.

I'm trying to integrate Stripe OAuth in a Rails application w/ Devise using this tutorial. I think I've followed it to a t, but I'm receiving this error when I go to Connect to Stripe on my app.

{"error":{"message":"No application matches the supplied client identifier"}}

I'm not sure how to check whether the client identifier I declare in my application.yml is even being passed in, or what value it's reading. Here's my setup so far:

config/application.yml (has my IDs from Stripe account - I edited them out here):

STRIPE_CONNECT_CLIENT_ID: "____________"
STRIPE_SECRET_KEY: "_____________"

config/initializers/devise.rb

Devise.setup do |config|

config.omniauth :stripe_connect,
      ENV['STRIPE_CONNECT_CLIENT_ID'],
      ENV['STRIPE_SECRET_KEY'],
      :scope => 'read_write',
      :stripe_landing => 'register'

*other config code*

end

config/routes.rb

Studiocracy::Application.routes.draw do
  devise_for :users, :controllers => { :omniauth_callbacks => "omniauth_callbacks", registrations: 'registrations' }
*other stuff*
end

controllers/omniauth_callbacks_controller.rb

class OmniauthCallbacksController < Devise::OmniauthCallbacksController

    def stripe_connect
        @user = current_user
        if @user.update_attributes({
            provider: request.env["omniauth.auth"].provider,
            uid: request.env["omniauth.auth"].uid,
            access_code: request.env["omniauth.auth"].credentials.token,
            publishable_key: request.env["omniauth.auth"].info.stripe_publishable_key
            })
      # anything else you need to do in response..
      sign_in_and_redirect @user, :event => :authentication
      set_flash_message(:notice, :success, :kind => "Stripe") if is_navigational_format?
  else
    session["devise.stripe_connect_data"] = request.env["omniauth.auth"]
    redirect_to new_user_registration_url
  end
end
end

app/views/devise/registrations/edit.html.erb

<%= link_to image_tag('stripe.png'), user_omniauth_authorize_path(:stripe_connect) %>
1
  • If you are using stripe connect then not only you need a "stripe connect client id" to be set but also a "stripe user id". In other words the "stripe connect ID" is who get the fees and the "stripe user ID" is who get the money. Of course the stripe user ID can be set dynamically depending on what you want to do. I recommend that you pass the ENV variables from your terminal like so STRIPE_CONNECT_CLIENT_ID=pk_testnkncknkn STRIPE_SECRET_KEY=pkc,kcdkdncknd rails s or in production heroku config:set PUBLISHABLE_KEY=pk_test_cdcdcdc SECRET_KEY=sk_test_cdcdcd
    – Antoine
    Apr 30, 2015 at 21:22

2 Answers 2

0

I did the same silly mistake. Later i found out, it is because of wrong client id i am passing. Just chech href tag of your connect to stripe button once and recheck.

0

I got a solution by adding just a foward slash (/) after the main URL before the question mark (?):

Before:

https://connect.stripe.com/oauth/v2/authorize?scope=read_write&client_id={client_id}&redirect_uri={https//:example.com}
                                             v
https://connect.stripe.com/oauth/v2/authorize/?scope=read_write&client_id={client_id}&redirect_uri={https//:example.com}
                                             ^

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.