Phone based OTP depends on high reliability of sou...
# ask-a-descoper
t
Phone based OTP depends on high reliability of source Phone number and if phone number changes we need a path to look up the user that is stable
b
Yes. You can do that. NodeJS SDK supports the `searchAl`l command, with `customAttributes`:
Copy code
searchAll: (tenantIds?: string[], roles?: string[], limit?: number, page?: number, testUsersOnly?: boolean, withTestUser?: boolean, customAttributes?: Record<string, AttributesTypes>) => Promise<SdkResponse<_descope_core_js_sdk.UserResponse[]>>;
(we will also add this to the docs)
t
Could we also chose to use the stripe customer ID for the loginID and still have them OTP with the phone?
We need a reliable way to handle updates to user attributes that have a reliable id that is unique and stable that matches the source system on for the customer records
b
Think it's a valid use case, but don't think we can do that today. we'll check and open a feature request is relevant.
s
@thousands-alarm-31103 could you get the stripe user ID and store as a custom attribute during the user's login flow? Then store it on the user? 1. Connect to stripe's api 2. Then get the user ID during the flow 3. Store to a custom attribute on the user for later use
t
It doesn’t support it no. We are also using the flows not the sdk, can we make a rest call for that search>
We could yes, that is what we are seeking to do
s
We have the ability to do this with connectors.
t
Right now we have a listener set up for events coming from stripe
Say more about connectors please?
s
I'm actively working on documenting this, but... Configure a connector to stripe https://app.descope.com/connectors Add a 3rd party connector item within your flow to get the user ID after the user is authenticated Then get the userID with that action. Then call the update user action to store the userID on the custom attribute. You can create the stripeUserId attribute from the users page as well.
Let me know if this makes sense.
But for
Could we also chose to use the stripe customer ID for the loginID and still have them OTP with the phone?
we're opening the FR for this, which would store stripe's user ID under the user's loginIDs, similar to how it's referenced in this article. https://docs.descope.com/knowledgebase/descopeflows/multipleloginid/multipleloginid/
t
^^ yes This is what I was looking at and then went and tested to see what it would do if I created a user with the stripe customer ID
s
Yea. For now, I think storing it as a custom attribute may be the best bet while we work on the FR.
t
Is there an api call we can make? We are not using the SDK, rather the flows in a web app
s
To ensure I understand right, an API call to get the user ID from Stripe and store it? Or to search based on the custom attribute after storing it? • For this, you can use the search users and add an additional
customAttributes
to the payload and populate it with the custom attribute you are searching for as an object. I will get docs updated for this this week. • http://localhost:3000/api/openapi/usermanagement/operation/SearchUsers/ Also, @dazzling-oyster-96577 may be able to help you set up connectors as well.
t
Not exactly. We can get the user ID from stripe when the create event posts to descope
We would want to store that on the user as custom attribute in descope. If the customer record gets updated we want to use the customer attribute (stripe cust ID) to look up the user and update attributes
So when an update comes in, we will the stripe customer ID with the update, so we need to match that id so that we can update the changed attributes
s
You can create users with custom attributes.
<https://docs.descope.com/api/openapi/usermanagement/operation/CreateUser/>
You can update custom attributes:
<https://docs.descope.com/api/openapi/usermanagement/operation/UpdateUserCustomAttribute/>
Then you can search based on custom attributes
<https://docs.descope.com/api/openapi/usermanagement/operation/SearchUsers/>
Like:
Copy code
curl -i -X POST \
  <https://api.descope.com/v1/mgmt/user/search> \
  -H 'Authorization: Bearer P2IBjb4s39ubA2tzOW75LfgbGRpR:<ManagementKey>' \
  -H 'Content-Type: application/json' \
  -d '{
    "tenantIds": [
      "string"
    ],
    "roleNames": [
      "string"
    ],
    "limit": 0,
    "text": "string",
    "page": 0,
    "loginId": "string",
    "ssoOnly": false,
    "customAttributes": {
       "attributeKey": "string",
       "attributeValue": "string"
    },
  }'