How to set redirect URI with pattern for OAuth 2 with Google?

1.8k Views Asked by At

I want to have multiple websites using same google account for oAuth authentication. The websites are generated and deployed dynamically and follows a same path pattern. So the redirect URI will change for each website and each URL individually cannot be added in Google developer console. Is it possible to add any pattern or directory as redirect URI.

My websites will follow the below pattern

wwww.domain.com/demo/<number>/oauth/google.html  

How can I keep <number> dynamic in the redirect URI?
1

There are 1 best solutions below

2
On

Is it possible to add any pattern or directory as redirect URI?

No.

You'll need to implement a proxy that Google redirects to which in turn redirects (or posts) to the actual oauthhandler.

NB Having xxxx.html as your your redirect URL is unusual as it would normally be some sort of server logic (a Java servlet, php page, etc). Are you sure you've understood what the redirect URl is doing?