I have an application where people can have account say url is http://localhost:3000. People can also register their domain and have their separate workspace now the url for those users would be http://abc.localhost:3000, where abc is the personal domain user has.For normal flow I am able to successfully run things. I want to support subdomain urls like http://abc.localhost:3000 for google drive login. I was going through solutions already there, as app can support N number of subdomains so I cannot add different urls to redirect uri. So I need to have one uri. How can I have common redirect uri which can help me in both cases
This is my code
window.gapi.client
.init({
clientId: googleDriveClientId,
scope: 'https://www.googleapis.com/auth/drive.readonly',
})
.then(() => {
this.auth = window.gapi.auth2.getAuthInstance();
this.handleAuthChange();
this.auth.isSignedIn.listen(this.handleAuthChange);
});
With the above code I am able to login normally but for subdomain urls it gives me issue

I tried to add redirect_uri: 'http://localhost:3000' to my init method but still get the same issue.I read about state property to carry subdomain value with it but this auth errors comes due to uri mismatch. Can someone help me to identify the code which I need to add to support subdomains ?