简体   繁体   English

如果使用 oAuth,Twinfield 是否需要会话?

[英]Twinfield do you need sessions if using oAuth?

I'm updating a third party app that currently integrates with Twinfield using the session's method with username and password to use the oAuth method.我正在更新当前与 Twinfield 集成的第三方应用程序,使用带有用户名和密码的会话方法来使用 oAuth 方法。

In confused by the documentation though... do I still need to use the sessions or when using oAuth do I just call the endpoint(s) by passing the access token in the header as normal?虽然被文档弄糊涂了......我是否仍然需要使用会话或在使用 oAuth 时我是否只是通过像往常一样在标头中传递访问令牌来调用端点?

Also their Soap definition has four properties, the usual ClientID and Secret but also accessSecret?另外他们的 Soap 定义有四个属性,通常的 ClientID 和 Secret 但还有 accessSecret? What's that?那是什么?

TLDR: you no longer need to use the sessions and SelectCompany; TLDR:您不再需要使用会话和 SelectCompany; when you have the access token you can use that and the company code directly in the header.当您拥有访问令牌时,您可以直接在标题中使用该令牌和公司代码。 You can obtain the access token as described here .您可以按照此处所述获取访问令牌。

The documentation is a bit unclear on how to use the access token in your calls.关于如何在调用中使用访问令牌,文档有点不清楚。

In the old username/password/session flow, you referred to a SessionID in the SOAP Header, and you would do a SelectCompany call to select the relevant target ("administratie").在旧的用户名/密码/会话流中,您引用了 SOAP 标头中的SessionID ,并且您将执行SelectCompany调用以选择相关目标(“administratie”)。

In the OAuth flow, the SessionID is no longer relevant.在 OAuth 流程中,SessionID 不再相关。 Once you obtained a valid access token, you should set that in the header using the AccessToken field.获得有效的访问令牌后,您应该使用AccessToken字段在标头中进行设置。 Instead of the old SelectCompany call, you can set the CompanyCode directly in the header.您可以直接在标题中设置CompanyCode ,而不是旧的SelectCompany调用。 So if you have obtained an access token eyWhatANiceToken , and want to retrieve data for company "My Company BV [130001]" you have set AccessToken to eyWhatANiceToken and CompanyCode to 130001 in the header.所以,如果你已经获得的访问令牌eyWhatANiceToken ,并希望为公司获取数据“我的公司BV [130001]”您已设置AccessTokeneyWhatANiceTokenCompanyCode ,以130001的头。

You can request the available codes using the list offices call您可以使用列表办公室电话请求可用代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM