How to get the account subdomain when the user authorizes a Global oAuth client? | Community
Skip to main content

How to get the account subdomain when the user authorizes a Global oAuth client?

  • November 12, 2021
  • 11 replies
  • 0 views

Rodrigo13

Hi!

I'm building an app that will be deployed for any Zendesk account, so I will need a Global oAuth Client.

But, when the user authorizes the installation, how do I get the account subdomain to make API calls?

I know that https://{subdomain}.zendesk.com/api/v2/brands give all info, but it requires a subdomain too...

 

Thanks.

11 replies

Eric27
  • November 15, 2021
Hey Rodrigo,

You're going to want to use the context method offered from the Apps Framework. This will provide you the subdomain of the instance your app has been installed in along with other useful information.

Hope this helps,

Rodrigo13
  • Author
  • November 16, 2021

I'm not using the ZAF Client API. I'm using only the RESTful API.

Researching more, it looks like I need to ask the subdomain before the user authorizes the App, even if it's using the global OAuth client. Is that correct?

If yes, the design is horrible and painful for end-users.


Eric27
  • November 16, 2021
Hey Rodrigo,

It sounds like this is going to be a third-party application and not one built within the Zendesk Instance, is that correct? If so, then you're correct and is an expected pattern for an oAuth flow. After the asking for the user's subdomain you could then store this in that user's profile of your application for future use. 

Rodrigo13
  • Author
  • November 16, 2021

Yes, it's correct.

Thanks.


Hi @rodrigo13,

Have you got any luck with what you were trying to achieve? 
I am also on the same page as you were. Do you found any solution on how we get subdomain when using Global OAuth Clients?  


Rodrigo13
  • Author
  • August 12, 2022

Hi @Shriniwas Kulkarni,

Yeah, there is no solution, you need to ask the subdomain so you can continue the oauth.


@rodrigo13,
Ohh Okay!
But I am a bit confused here If we are setting up Global OAuth clients in our admin panel to take access of other Zendesk accounts and their APIs. Then what's the point of Global OAuth Clients if we ask for a subdomain? Isn't it? 


Eric27
  • August 15, 2022
Hey Shriniwas,

You need to request the subdomain from the customer so that the oauth process can complete. Without it, your app wouldn't know what instance it needs to access. We cover this in the frequently asked questions. Usually customers handle this by requesting it from the customer using an app parameter. That way when the customer installs the app, they provide that information.
 
Hope this helps!

Hi @eric27,

Okay, thanks for the reply and guidance. Much appreciated.


Irakli
  • February 16, 2026

Hi @eric27 

 

For example I have global oath client, and ten different zendesk clients added it as OAuth client. I expose http://example.app/oauth/zendesk/callback to receive the callbacks. How can I understand what company (subdomain) made the callback? I'm testing now with local OAuth client and there is no information about who sends the callback request (I checked request headers and query params).


Greg29
  • February 18, 2026

Hi @irakli,

 

I'm not aware of anything that we expose that we provide this information. Can you let me know more about why you are looking for this so that we can see if there's another solution we can come up with?