Subdomain in Google Console Redirect URIs

IPValverde picture IPValverde · Nov 30, 2012 · Viewed 13.9k times · Source

I have an web application that uses google api (google drive). The application is used by many clients and every client has an subdomain to access the system.

So the domain is appdomain.com

And for users I have foo.appdomain.com, bar.appdomain.com, etc.appdomain.com.

But in google console redirect URI I have to manually put the redirect urls, is there any way I can use wildcards to redirect to make google accept any of subdomains like: *.appdomain.com ?

With this I can make the google authorization calls with the user subdomain in redirect_uri:

https://accounts.google.com/o/oauth2/auth?redirect_uri=http://foo.appdomain.com

Answer

vlatko picture vlatko · Dec 7, 2012

Wildcard matching subdomains is not supported in Google OAuth. You could try using the state parameter and include the user-specific information there. This parameter will be returned to you in the response. More information on state here.