cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

According to the Thingworx documentation, an attempt was made to develop a Gmail OAuth2 connector th

xsu
3-Visitor
3-Visitor

According to the Thingworx documentation, an attempt was made to develop a Gmail OAuth2 connector th

Reference documentation:

 

Tutorial A: Implement a Custom Connector Using ThingWorx Flow SDK

Tutorial B: ThingWorx Flow Connectors SDK Tutorial

Testing Connectors

 

Test locally through the above example, but there is an error, and the local configuration is as follows:

OAuth Connectors ,oauthGmail-gmail

 

 

 

{
  "name": "oauthGmail-gmail",
  "created_at": "2023-03-22T07:09:55.344Z",
  "updated_at": "2023-03-22T07:09:55.344Z",
  "uid": "6ad15babeeae449e9ccc7ac588cb9c60",
  "icon": "Add name of the Connector icon",
  "category": "",
  "title": "Add title for the Oauth",
  "oauth2_include": [],
  "oauth2_required": [],
  "oauth2_params_scope": [
    "{\"https://www.googleapis.com/auth/gmail.labels\":\"Manage mailbox labels\"}",
    "{\"https://www.googleapis.com/auth/gmail.insert\":\"Insert mail into your mailbox\"}",
    "{\"https://www.googleapis.com/auth/gmail.modify\":\"All read/write operations except immediate, permanent deletion of threads and messages, bypassing Trash.\"}",
    "{\"https://www.googleapis.com/auth/gmail.readonly\":\"Read all resources and their metadata—no write operations.\"}",
    "{\"https://www.googleapis.com/auth/gmail.compose\":\"Create, read, update, and delete drafts. Send messages and drafts.\"}",
    "{\"https://www.googleapis.com/auth/gmail.send\":\"Send email on your behalf\"}"
  ],
  "oauth2_refresh_data": [
    "{\"client_secret\":\"{client_secret}\"}",
    "{\"grant_type\":\"refresh_token\"}",
    "{\"client_id\":\"{client_id}\"}",
    "{\"refresh_token\":\"{refresh_token}\"}"
  ],
  "oauth2_refresh_url": "/token",
  "oauth2_token_data": [
    "{\"redirect_uri\":\"{redirect_uri}\"}",
    "{\"client_id\":\"{client_id}\"}",
    "{\"client_secret\":\"{client_secret}\"}",
    "{\"grant_type\":\"authorization_code\"}"
  ],
  "oauth2_token_url": "/token",
  "oauth2_auth_query": [
    "{\"client_id\":\"{client_id}\"}",
    "{\"response_type\":\"code\"}",
    "{\"resource\":\"{resource}\"}",
    "{\"scope\":\"{scope}\"}",
    "{\"redirect_uri\":\"{redirect_uri}\"}"
  ],
  "oauth2_validate_url": "",
  "oauth2_validate_method": "GET",
  "oauth2_validate_headers": [
    "{\"Authorization\":\"Bearer {access_token}\"}",
    "{\"Content-Type\":\"application/json\"}"
  ],
  "oauth2_auth_url": "/auth",
  "oauth2_no_state": false,
  "env_production_params": [],
  "env_pre_prod_params": [
    "{\"redirect_uri\":\"{OAUTH_ENDPOINT_OAUTH_RETURN}\"}",
    "{\"client_id\":\"{{{pre_prod.CLIENT_ID}}}\"}",
    "{\"client_secret\":\"{{{pre_prod.CLIENT_SECRET}}}\"}"
  ],
  "env_staging_params": [],
  "env_development_params": [
    "{\"redirect_uri\":\"{OAUTH_ENDPOINT_OAUTH_RETURN}\"}",
    "{\"client_id\":\"{{{development.CLIENT_ID}}}\"}",
    "{\"client_secret\":\"{{{development.CLIENT_SECRET}}}\"}"
  ],
  "env_local_params": [
    "{\"redirect_uri\":\"{OAUTH_ENDPOINT_OAUTH_RETURN}\"}",
    "{\"client_id\":\"{{{local.CLIENT_ID}}}\"}",
    "{\"client_secret\":\"{{{local.CLIENT_SECRET}}}\"}"
  ],
  "base_url": "https://accounts.google.com/o/oauth2/v2",
  "oauth_type": "OAuth2",
  "development_phase": "gold",
  "advanced_enabled": true,
  "express_enabled": false,
  "deleted_at": null,
  "published": true,
  "__v": 0
}

 

 

 

 

.flow 

XS_9736278_0-1679561466698.png

.flow\flow.json

 

 

 

{
    "hostname" : "flow.local.rnd.ptc.com",
    "port" : 443
}

 

 

 

 

Execute the test command through cmd,Pop-up 404 box

 

 

 

flow test oauth oauthGmail-gmail -f ..\testOauthData.json -t "Test Gmail Oauth"

 

 

 

 

XS_9736278_1-1679561585915.png

There are no logs in the .pm2 flolder

XS_9736278_2-1679561668544.png

Could you tell me where the misconfiguration caused the problem?

 

 

1 REPLY 1
slangley
23-Emerald II
(To:xsu)

Hi @XS_9736278.

 

Can you provide the version of ThingWorx you are running?

 

Regards.

 

--Sharon

Top Tags