2017-07-07 16 views
-1

私は現在、レール上にルビーを搭載したエアブッブを作成するためのオンラインコースを取っています。それは支払いのためにストライプを利用し、ログインページの代わりに私のアプリからストライプへのランディングページを登録ページにしたいと思っています。ストライプランディングページの設定が正しく動作しない

私は完全に次のコードを含むランディングページとして登録ページを作成するチュートリアルに従っています。

stripe_landing:

'登録' しかし、私のランディングページは、まだログインページです。私は上記のコードを探査しましたが、私が見つけたのは2〜4年前のページでした。ストライプが最近それを変更したのだろうかと思う。 (でもhparは何も変わっていないと答えました)

私はここにコード全体を入れました...私はStripeへのリンクをクリックすると、#oauthのストライプに行きます。その後、

class StripeController < ApplicationController 
     # Connect yourself to a Stripe account. 
     # Only works on the currently logged in user. 
     # See app/services/stripe_oauth.rb for #oauth_url details. 

     def oauth 
     connector = StripeOauth.new(current_user) 
     url, error = connector.oauth_url(redirect_uri: stripe_confirm_url) 

     if url.nil? 
      flash[:error] = error 
      redirect_to manage_listing_payment_path(session[:listing_id]) 
     else 
      redirect_to url 
     end 
     end 

    end 

class StripeOauth < Struct.new(:user) 

     def oauth_url(params) 
     url = client.authorize_url({ 
      scope: 'read_write', 
      stripe_landing: 'register', 
      stripe_user: { 
      email: user.email 
      } 
     }.merge(params)) 

     [ url, nil ] 
     end 

     # A simple OAuth2 client we can use to generate a URL 
     # to redirect the user to as well as get an access token. 
     # Used in #oauth_url and #verify! 
     # see this docs https://github.com/intridea/oauth2 
     def client 
     @client ||= OAuth2::Client.new(
      ENV['STRIPE_CONNECT_CLIENT_ID'], 
      Stripe.api_key, 
      { 
      site: 'https://connect.stripe.com', 
      authorize_url: '/oauth/authorize', 
      token_url: '/oauth/token' 
      } 
     ).auth_code 
     end 

    end 

端末は言います。

は、 "ユーザー" を選択HTML ユーザー負荷(0.1ms)としてStripeController#1のOAuthによる2017年7月9日に:: 1午前0時37分55秒0800 処理のための "/接続/ OAuthの" GET開始しました。* FROM "users" WHERE "users"。 "id" =? "ユーザー"。 "ID" ASCのLIMIT 1 [[ "idは"、1]] https://connect.stripe.com/oauth/authorize?client_id=ca_AuidWGx68TXWlWO3d3UbWcRcuPqfSeNH&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fconnect%2Fconfirm&response_type=code&scope=read_write&stripe_landing=register&stripe_user%5Bemail%5D=aaa%40gmail.com

にリダイレクトので、私は、私は(ビデオが取得するチュートリアルと同じ)ここでは、右のURLを取得すると思うBY ORDER。しかし、Chromeでは、実際には、

https://connect.stripe.com/login?redirect=%2Foauth%2Fauthorize%3Fclient_id%3Dca_AuidWGx68TXWlWO3d3UbWcRcuPqfSeNH%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%253A3000%252Fconnect%252Fconfirm%26response_type%3Dcode%26scope%3Dread_write%26stripe_landing%3Dregister%26stripe_user%255Bemail%255D%3Daaa%2540gmail.com&force_login=true

貧しい説明のために申し訳ありません

が、誰もがこの謎を解くことができればそれは素晴らしいことです。どうもありがとう!

https://stripe.com/docs/connect/oauth-reference#get-authorize-request

あなたはこの例でリンクを開くことで、これをテストすることができます:

+0

私たちは、他のコードや画像を見て、答えに役立てるのが大好きです。 –

答えて

0

は私がサファリにしようと、それが働きました適切に私はクロム上の関連するクッキーを削除し、それは働いた。

0

何もこの最近のストライプのドキュメントによるについて変更されてい

https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_32D88BD1qLklliziD7gYQvctJIhWBSQ7&scope=read_write&stripe_landing=register

+0

返信いただきありがとうございます。私はサンプルリンクを試してみました。ログインページですが、URLの最後に「force_login = true」があるため、何か問題が起きたかどうかは疑問です。あなたが任意のアイデアを持っている場合は... https://connect.stripe.com/login?redirect=%2Foauth%2Fauthorize%3Fresponse_type%3Dcode%26client_id%3Dca_32D88BD1qLklliziD7gYQvctJIhWBSQ7%26scope%3Dread_write%26stripe_landing%3Dregister&force_login=true – ymatt

関連する問題