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

image avatar

Eric Nelson

Zendesk Developer Advocacy

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,

0


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


image avatar

Eric Nelson

Zendesk Developer Advocacy

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. 

0


Yes, it's correct.

Thanks.

0


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


Hi @Shriniwas Kulkarni,

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

0


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


image avatar

Eric Nelson

Zendesk Developer Advocacy

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!

1


Hi Eric Nelson,

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

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post