SohoHouse / nuxt-oauth

Simple OAuth2 integration for your Nuxt app
MIT License
122 stars 27 forks source link

Dynamic configuration not really dynamic? #26

Closed col-panic closed 4 years ago

col-panic commented 6 years ago

I have deployed the nuxt app behind an nginx proxy. The proxy does forward wildcard domains like a.myexample.com and b.myexample.com to the nuxt.js instance.

a.myexaple.com uses oauth host a, and b.myexample.com uses oauth host b. I can differentiate those via the incoming request.

Now the problem is, that this seems to be done only once - so it isn't really dynamic.

If I start browser A and access a.myexample.com it binds against oauth host a. If I then start browser B and access b.myexample.com - no binding against host b happens (at least the resp. code does not seem to be called).

So if selection of the oauth host only happens once after startup - to what degree is the configuration dynamic?

thanks

samtgarson commented 5 years ago

Hi @col-panic, this isn't a use case that we had previously needed but it's definitely a valid one.

Do you have any ideas on how this could be implemented?

col-panic commented 5 years ago

I did an implementation of a possible solution once that fixed this. I described it in https://github.com/SohoHouse/nuxt-oauth/issues/18 - the approach you proposed there did not work out for me.

Unfortunately, in the meantime I switched away from nuxt to a plain vue.js based solution. I deliver the configuration data via an nginx based configuratoin that serves a different config.js file based on the resp. name based host. I then read this config.js on startup and derive the correct oauth server from it.

samtgarson commented 5 years ago

I remember the issue. I still believe there's a solution in there somewhere, we will be needing it at some point so if you ever need to return to Nuxt, check back here.

I'll leave this issue open in case we get a fix.

samtgarson commented 4 years ago

This has been fixed a while ago with providing functions for OAuth config.