Skip to main content

Hi team, I am a new developer, and I need your help.
I have a website for users with domain app.xxx.com, and a support website with articles support.xxx.com. I am setting my page articles to private access, so if the user is not logged in, they will see the message "Unable to load this article, you may need to sign in first" with the button url.

I am looking for a way that after clicking the button url, it redirects from page support.xxx.com/en/articles/yyy to our login page app.xxx.com, after login it redirects back to the page articles support.xxx.com/en/articles/yyy. i can do that if i add query return_to = support.xxx.com/en/articles/yyy. But each page will have a different url, is there a way i can get the current url address and set it to the button url?

Hey there ​@Dev Tem! Emily here from Support Engineering 👋🏼
 

To achieve the redirection after login, you can utilize the OAuth flow provided by Intercom. You can set up multiple Redirect URLs in your OAuth settings, which allows you to include both testing and production URLs. After a user logs in, you can dynamically specify which Redirect URL to use by including the redirect_uri parameter in your OAuth flow. This parameter can be set to the current URL of the article the user was trying to access. By doing so, after the user logs in through your main app domain, they will be redirected back to the specific support article they were viewing.

Here's a step-by-step process:

  • Set up your OAuth with Intercom and include the Redirect URLs for your support articles.
  • When a user attempts to access a private article and needs to log in, initiate the OAuth flow with the redirect_uri parameter set to the current article's URL.
  • After the user logs in on your main app domain, they will be redirected back to the article they were trying to access.
  • Remember that Redirect URLs must use HTTPS and communicate over a TLS/SSL connection.

Hope this help clear things up for you a bit.

All the best for your developing career! ☘️


Reply