This topic was automatically generated from Slack. You can find the original thread here.
When using Pipedream Connect’s server SDK to retrieve account details with
accounts.retrieve(accountId, { includeCredentials: true }), what’s the structure of the
credentials object for OAuth apps like Google Sheets?"
I’m trying to find where the connected user’s email address is stored. Is it typically in:
credentials.email
credentials.userinfo.email
Or somewhere else?
Is there documentation on the credentials object structure for different OAuth providers?
Based on the available documentation: ### Structure of the credentials Object for OAuth Apps (e.g., Google Sheets) When you use Pipedream Connect’s API to retrieve account details with accounts.retrieve(accountId, { includeCredentials: true }), the structure of the credentials object depends on the app and how Pipedream stores the OAuth data for that provider. For Google Sheets (and most Google OAuth apps), the credentials object typically contains OAuth tokens and sometimes additional user info. However, the connected user’s email address is not guaranteed to be in a top-level credentials.email property. #### Where is the user’s email address stored? - Most commonly: The email address is found in credentials.userinfo.email if Pipedream fetched and stored the user profile info at the time of connection. - Sometimes: It may be in another property, but for Google OAuth apps, userinfo is the standard sub-object where user profile data (including email) is stored. - Rarely: It is not typical for the email to be stored directly as credentials.email for Google OAuth apps. #### Example credentials object (Google Sheets): on { "access_token": "ya29.a0AfH6SM...", "refresh_token": "1//0g...", "scope": "https://www.googleapis.com/auth/spreadsheets.readonly ...", "token_type": "Bearer", "expiry_date": 1710000000000, "userinfo": { "id": "1234567890", "email": "[user@example.com](mailto:user@example.com)", "verified_email": true, "name": "User Name", "given_name": "User", "family_name": "Name", "picture": "https://lh3.googleusercontent.com/...", "locale": "en" } } So, the connected user’s email is typically at: credentials.userinfo.email — ### Documentation on the credentials object structure - There is no universal, app-agnostic documentation for the structure of the credentials object for every OAuth provider on Pipedream. - The REST API docs show how to retrieve credentials, but the structure is app-specific. - For Google apps, you can expect a userinfo object if profile info was fetched at connection time. #### References: - Pipedream REST API: Get account credentials - Accessing credentials via API — ### Summary Table | Property | Likely to contain email? | Notes | |----------------------------------|:-----------------------:|-----------------------------------------------------| | credentials.email | | Not typical for Google OAuth apps | | credentials.userinfo.email | | Standard for Google OAuth apps | | credentials.profile.email | | Possible for some providers, not standard for Google| — If you need to confirm for a specific app, retrieve the credentials and inspect the object, or check the app’s docs. If you need more details or want to request documentation for a specific provider, you can contact Pipedream support. — Let me know if you need a code example for retrieving and parsing this data!
Thank you for your correction, and I’m sorry for the confusion in my previous answer. You are right: when retrieving account details using Pipedream Connect’s server SDK, the connected user’s email address is typically found in the account.name field, not in credentials.email or credentials.userinfo.email. This is consistent with how Pipedream exposes account information for OAuth apps like Google Sheets: - The account.name field usually contains the connected user’s email address. - The credentials object contains authentication tokens and related data, but not always the user’s email. If you need further help or want to clarify any details, please visit Support - Pipedream for more support options. Again, apologies for the earlier mistake, and thank you for pointing it out!
Thank you! I saw that YC companies get a discount, do you have any active discounts I could use? I’m not YC, we’re fully bootstrapped, on the Connect plan.