-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
finchClient.connect.sessions.new returns 401 for valid newly created accessToken #470
Comments
Hi @isabinin, what version of the finch SDK are you using? And could you try to install the latest version and tell us if that fixes the issue? |
|
As you can see I use access token for authentication but I'm getting the following error message: Other Finch APIs (e.g. HRIS) are working fine with the same access token |
Thanks for the details, that does indeed look like an SDK issue. We are looking into it |
Hey @isabinin thanks again for flagging this! We should have a fix for this going out in release 6.7.0. One small note though: you want to create a session before requesting an accessToken. There's a bit more details here on the ideal flow: https://developer.tryfinch.com/implementation-guide/Connect/Set-Up-Finch-Connect#create-a-connect-session |
The fix didn't resolve the issue, I'm getting the same error. "finch-request-id": "6dec4cd0-8779-11ef-b8ee-97d3c1a3758c",
|
Hey @isabinin could you share the code and the errors you're seeing this time around? The following snippet is working for me on 6.7.0:
|
Thank you for the code sample, it didn't work with accessToken authentication, but it works with clientId/clientSecret auth. |
HTTP 401 is returned for the following code snippet:
const accessTokenResponse = await finchAccessClient.accessTokens.create({ code: event.arguments.code, client_id: process.env.FINCH_CLIENT_ID, client_secret: process.env.FINCH_CLIENT_SECRET, redirect_uri: event.arguments.redirectUri ?? undefined, }); const finchClient: Finch = new Finch({accessToken: accessTokenResponse.access_token}); const createConnectSessionResponse = await finchClient.connect.sessions.new({ products: accessTokenResponse.products, customer_id: event.arguments.accountId, customer_name: accountName, integration: { provider: accessTokenResponse.provider_id, }, minutes_to_expire: 525600, // 1 year sandbox: "finch", });
Error response headers:
"headers": { "connection": "keep-alive", "content-length": "88", "content-security-policy": "default-src 'self';base-uri 'self';font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests", "content-type": "application/json; charset=utf-8", "cross-origin-opener-policy": "same-origin", "cross-origin-resource-policy": "same-origin", "date": "Wed, 09 Oct 2024 04:56:36 GMT", "etag": "W/\"58-QJN6fjo5fSoBFO57KQ4+ChQL4Zs\"", "finch-request-id": "dc8ad920-85fa-11ef-adc8-b3c324f42378", "origin-agent-cluster": "?1", "referrer-policy": "no-referrer", "strict-transport-security": "max-age=31536000; includeSubDomains", "x-content-type-options": "nosniff", "x-dns-prefetch-control": "off", "x-download-options": "noopen", "x-frame-options": "SAMEORIGIN", "x-permitted-cross-domain-policies": "none", "x-xss-protection": "0" }
The text was updated successfully, but these errors were encountered: