OAuth and redirect from an endpoint?


We’ve already implemented OAuth of Intercom before. But one thing is not clear. In “The install URL”
section of the doc, it is written:

“This URL should either redirect immediately to https://app.intercom.io/oauth?client_id= or can do some processing before redirecting to that URL but in either case, this URL should trigger the Intercom OAuth flow.”

I don’t understand how I can redirect from an endpoint? I need to send a real-time message to our frontend that open a new window with the OAuth link. But also, I need to know which user this is as well.

May I get more information about it?



Hi Volkan,
It can be a little tricky to understand the OAuth flow, we are looking at trying to make this clearer so any suggestions you have would be welcome.
For the redirect you would just need to implement a HTTP 302 response to redirect to the Intercom OAuth URL. This is the same URL that the connect to Intercom button redirects to if you currently have OAuth setup for Intercom.
If you want to know the Intercom user then you could use the OAuth token you get to make a request the the /me API endpoint to get details on that user.
Alternatively, you could use one of the OAuth libraries which usually bundle in this functionality transparently. e.g the omniauth library

Let me know if that helps



Hello Choran,

Thanks for the reply. I did know 301 but didn’t know 302. I’ve implemented it but I still get an error. And unfortunately, we can’t see what the error is. I’m guessing that scenario:

Then what should suppose to be happen?

Our OAuth implementation uses a frontend url for redirect url. Is it important for that?

Does the teammate see the permission page?



Hi Volkan,
Yeah, you won’t be able to implement OAuth in that way for Messenger apps. The OAuth flow is described here for Messenger apps. So the install_url will enable Intercom teammates to install your app in their workspace. This will occur via the install app link. That way you will be able to get the access token as part of that flow as described in the link above.
Once you have the access token you should be able to then make any API calls you need.
Does that seem a little clearer?



Ahh I see, I mixed up initialize_url and install_url. I couldn’t find a place to update the install_url. I see you change it in your end manually.



@choran @jeff when our push to production approaches will the OAuth scopes become available to our “main workspace”?

In the current flow with the dev workspace we essentially have two different oauth tokens to maintain for a single intercom account



Yes. We’ll update the score on your current oauth client. :wink:

1 Like