Recent searches
No recent searches
How to get the account subdomain when the user authorizes a Global oAuth client?
Answered
Posted Nov 12, 2021
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.
0
9
9 comments
Eric Nelson
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,
0
Rodrigo Fraga
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.
0
Eric Nelson
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.
0
Rodrigo Fraga
Yes, it's correct.
Thanks.
0
Shriniwas Kulkarni
Hi Rodrigo Fraga,
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?
0
Rodrigo Fraga
Hi @Shriniwas Kulkarni,
Yeah, there is no solution, you need to ask the subdomain so you can continue the oauth.
0
Shriniwas Kulkarni
Rodrigo Fraga,
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?
0
Eric Nelson
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!
1
Shriniwas Kulkarni
Hi Eric Nelson,
Okay, thanks for the reply and guidance. Much appreciated.
0