Customer portals are a very powerful way to increase collaboration and create transparency between you and your customers.
When a customer portal is shared via a link it can often get lost and there might be a constant need to re-share it. However, if you surface it inside your application it can create a more efficient workflow and serve as a visual reminder to check on it more often.
This is why we provide you with an option to create a link tag to bring the portal inside your own application or product.
This "one-click" solution requires a smaller technical effort on your end, but then allows your endusers to open the portal with a single click from within your own app.
π€ Disclaimer: This might get a bit nerdy so if you are not someone with access to the backend of your app, maybe just share this article with those who can do this for you.
Here's how it works:
A. Show a link to the portal somewhere in your app
One click access requires you to put a link to the portal somewhere in your app (button called Portal Link" in the illustration above). In most scenarios though not all of your endusers will have access to your Planhat customer portal, so you only want to show this link/button to the users who actually have access.
To know if an enduser has access or not (ie if you should show this button or not) you can call the Planhat api with your API token as for all other endpoints.
GET {API_ENDPOINT}/shareabletokens/access/{enduserId}
B. Redirect user to a signed url of the portal
This can be implemented in a few different ways but this is what a typical process would look like:
B1. User clicks the portal button in your app
This would result in a request to your own api or some other backend service including the enduser's id.
B2. You backend server request the signed url
Call this endpoint of the Planhat API (requires api token in the header) GET {API_ENDPOINT}/shareabletokens/{enduserId}
B3,4. Open a new tab with the redirect URL If user is found and has an access to his Portal it will print out a link in a format {PORTAL_URL}/redirect/{redirectToken}
that when used authenticates user without any credentials. Please note that these links are short lived and will need to be used within 30 seconds before they expire.
π Important note: The {PORTAL_URL}
is on the form share-{cluster}
so if your access of Planhat is served from eu5 for example, then you'll see a url like https://app-eu5.planhat.com/ as a url, you'll access the API at https://api-eu5.planhat.com/ and the {PORTAL_URL}
would be https://share-eu5.planhat.com/ . If you're on app.planhat.com, then your portal url is simply https://share.planhat.com/.
C. Portal Access
When redirected, Planhat will confirm the redirect URL and replace it with a proper session token and the user is logged in to the Portal. β