Step 2: Configure the Yext IDP with your Website
A developer will have to complete this part, which has two main parts, adding the Yext Login and configuring an API token to pass the user identity to Yext.
In order to link the Yext IDP to your website, you’ll need to provide your clientID, client Secret, and redirect URI, and KeyID from the developer console to your repo. Some things to note below:
- To the redirectURI, append “/api/auth/redirect”
Your SignIn URL may look something like the following:
{ANSWERS_API}/oauth2/authorize?client_id={CLIENT_ID}&redirect_uri={redirect_uri}&scope=openid%20profile&response_type=code&response_mode=query&nonce={nonce}&state=${redirect_uri}
To obtain an access token, you’ll need to append “/oauth2/accesstoken” to your API call with a grant_type of “authorization_code” and all the OAuth information (clientID, client Secret, redirect URI).
Follow the steps in this guide to learn how to mint your own identity tokens and add Yext identities as a query param.
Optional: Pass Visitor Information to Search for Analytics
For more information on analytics, see the Visitor Analytics step of this guide.
For analytics, we want to know who each user is so we can understand and analyze visitor level behaviors. In order to get this information, we’ll need to pass the visitor attribute to the Search API for it to be stored in search logs.
In order to set the visitor attribute, the developer sets the visitor object to include the idMethod and id as seen below. Then, when a user engages with click events, the attribute is passed to the API to be stored in search logs for analytics.
visitor: { idMethod: "YEXT_USER", id:"{INSERT_YEXT_EXTERNAL_USER_ID"}