Can you retrieve the Intuit User ID through OAuth

*爱你&永不变心* 提交于 2021-02-07 20:49:34

问题


I am creating a connection to QuickBooks Online using the "Connect To QuickBooks" button as described on the following page:

http://docs.developer.intuit.com/0025_Intuit_Anywhere/0010_Getting_Started/0020_Connect/0010_From_Within_Your_App/Implement_OAuth_in_Your_App

Using this method is it possible to retrieve the Intuit User ID that the user entered (when prompted during the Intuit Sign In dialog) so that I can associate that user ID with the access token, access token secret, and realmId that is returned.


回答1:


Intuit has a "current user" API which does what you're asking for. You could make this API request as soon as you get the OAuth tokens from Intuit, and then record the association in your app.

Here are the docs for it:

  • https://developer.intuit.com/docs/0100_quickbooks_online/0100_essentials/0085_develop_quickbooks_apps/0004_authentication_and_authorization/platform_api

You basically do an OAuth GET request to this URL:

  • https://appcenter.intuit.com/api/v1/user/current

And Intuit returns a response like this which will give you the person's name and e-mail address:

<?xml version="1.0"?>
<UserResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xmlns="http://platform.intuit.com/api/v1">
  <ErrorCode>0</ErrorCode>
  <ServerTime>2012-04-13T18:47:34.5422493Z</ServerTime>
  <User>
    <FirstName>John</FirstName>
    <LastName>Doe</LastName>
    <EmailAddress>JohnDoe@g88.net</EmailAddress>
    <IsVerified>true</IsVerified>
  </User>
</UserResponse>


来源:https://stackoverflow.com/questions/16197470/can-you-retrieve-the-intuit-user-id-through-oauth

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!