Ruby on rails 条带登录页设置不工作
我目前正在参加一个在线课程,用RubyonRails制作一个类似airbnb的web应用程序。它利用条带进行支付,我想让从我的应用程序到条带的登录页面成为注册页面,而不是登录页面 我完全遵循教程,成功地使用下面的代码将注册页面作为登录页面 条纹登陆:“注册” 但我的登录页面仍然是登录页面。我用谷歌搜索了上面的代码,但我只能找到2-4年前的页面。我想知道Stripe最近是否改变了它。但是hpar回答说没有任何变化 我把全部代码都放在这里了。。。当我单击指向Stripe的链接时,它将转到stripeoauthRuby on rails 条带登录页设置不工作,ruby-on-rails,stripe-payments,stripe-connect,Ruby On Rails,Stripe Payments,Stripe Connect,我目前正在参加一个在线课程,用RubyonRails制作一个类似airbnb的web应用程序。它利用条带进行支付,我想让从我的应用程序到条带的登录页面成为注册页面,而不是登录页面 我完全遵循教程,成功地使用下面的代码将注册页面作为登录页面 条纹登陆:“注册” 但我的登录页面仍然是登录页面。我用谷歌搜索了上面的代码,但我只能找到2-4年前的页面。我想知道Stripe最近是否改变了它。但是hpar回答说没有任何变化 我把全部代码都放在这里了。。。当我单击指向Stripe的链接时,它将转到stripe
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
那么
终端说,
于2017-07-09 00:37:55+0800为::1启动GET/connect/oauth
StripeControlleroauth以HTML格式处理
用户加载0.1ms从users.id=?按用户订购。id ASC限制1[[id,1]]
重定向到
所以我想我在这里得到了正确的url,就像教程视频一样。然而,在Chrome中,它实际上是:
很抱歉解释得不好,但如果有人能解开这个谜团那就太好了。非常感谢 根据Stripe的文档,最近这方面没有任何变化: 您可以通过打开以下示例链接来测试这一点:
我在safari上试过,它工作正常,所以我删除了chrome上的相关cookie,它工作正常。我们喜欢在其他浏览器中看到一些代码或图像来帮助回答问题。感谢回复。我刚刚尝试了示例链接,得到了这个。它仍然是登录页面,我想知道我是否设置了错误,因为url末尾有force_login=true。如果你有任何想法。。。
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