通过OAuth流传递状态参数

通过OAuth流传递状态参数,oauth,dwolla,Oauth,Dwolla,我们有一个多租户应用程序(AccountingSuite.com),我们希望在应用程序中有一个connecttodwolla按钮 按钮将打开: https://www.dwolla.com/oauth/v2/authenticate?client_id={client_id}&response_type=code&redirect_uri={redirect_uri}&scope={scope}&state={instance_id} 请注意,在多租户应用程序的末尾有一个状态参数,用于标识实例。

我们有一个多租户应用程序(AccountingSuite.com),我们希望在应用程序中有一个connecttodwolla按钮

按钮将打开:

https://www.dwolla.com/oauth/v2/authenticate?client_id={client_id}&response_type=code&redirect_uri={redirect_uri}&scope={scope}&state={instance_id}

请注意,在多租户应用程序的末尾有一个状态参数,用于标识实例。成功身份验证后,响应URI需要包含
状态
参数,否则我们无法确定哪个实例发送了连接请求。当前,返回中的
状态
参数被剥离

这是一个非常标准的OAuth流(例如,请参见Stripe)


请告诉我我做得不对的地方,或者在OAuth流中传递state参数。

虽然Dwolla不支持
state
参数,但是作为替代,您可以在
返回uri
中将
state
参数指定为querystring变量

例如,如果使用此返回URI:

http://www.example.com/somepage?state=foobar
授予您在Dwolla上的应用程序权限后,用户将通过以下方式重定向到您的应用程序:

http://www.example.com/somepage?state=foobar&code={OAuth Verification Code}