Q: How can I know which Terra user ID was authenticated by the widget?
SafeAardwolf1 month ago
After a user is authenticated using the Terra widget, an auth_success payload is sent to our webhook with a user_id. How would I get this user ID in the front end where the user gets redirected to after successful connection. What is the ideal flow here?
Danieladmin1 month ago
When Terra redirects to your site or app, post-auth success, we store the user_id
and reference_id
in the query parameters of the redirect, so you can get the user_id
in sync from the current url (Terra redirects also support deep links and the query paramets should still be accessible)
Alternatively, you can set a reference_id
when generating the widget which will also be sent with the auth_success
payload and every following payload.
SafeAardwolf1 month ago
Understood, what would be the ideal authentication flow
Danieladmin1 month ago
The ideal authentication flow using the Terra API would look something like this:
auth_success_redirect_url
, something like https://yourapp.com/terra/on_connection_success
. You should also supply a reference_id
, potetially your internal user-id format e.g USR1234.auth_success_redirect_url
you provided with the query parameters: https://yourapp.com/terra/on_connection_success?user_id=123-abced-456&reference_id=USR1234
user_id
to make a GET request