I'm using Actions Builder + OAuth implicit account linking + inline webhook fulfillment. Account linking is working. Here's the flow:
- Invocation
- Open sign in web page for oAuth authorization
- Redirect to https://oauth-redirect.googleusercontent.com/r/... with token
- Account is now linked; all fulfillment webhook requests have the token attached
- All fulfillment requests fail with Google oAuth library crash
Regardless of the format of access token I generate, a simple string, or a JWT, every subsequent request to the fulfillment webhook with the access token passed fails automatically:
Error: Wrong number of segments in token: Bearer 12345abcde
at OAuth2Client.verifySignedJwtWithCertsAsync (/workspace/node_modules/google-auth-library/build/src/auth/oauth2client.js:535:19)
at OAuth2Client.verifyIdTokenAsync (/workspace/node_modules/google-auth-library/build/src/auth/oauth2client.js:401:34)
at process._tickCallback (internal/process/next_tick.js:68:7)
With JWT formatted token:
SyntaxError: Can't parse token envelope: Bearer 12345abcdeJWTtoken: Unexpected token in JSON at position 0
at JSON.parse (<anonymous>)
at OAuth2Client.verifySignedJwtWithCertsAsync (/workspace/node_modules/google-auth-library/build/src/auth/oauth2client.js:542:29)
Example "webhookResponse" value in the Actions test console:
Unsuccessful webhook call due to client issue: Error querying agent endpoint. State: URL_UNREACHABLE, reason: UNREACHABLE_5xx.
{
"responseJson": {
"error": "Wrong number of segments in token: Bearer abcde12345"
}
}
package.json:
{
"name": "ActionsOnGoogleFulfillment",
"version": "0.0.0",
"private": true,
"description": "Actions on Google fulfillment",
"engines": {
"node": "10"
},
"main": "index.js",
"dependencies": {
"@assistant/conversation": "^3.0.1",
"firebase-admin": "^8.13.0",
"firebase-functions": "^3.7.0"
}
}
What are you supposed to do here?