-
-
Notifications
You must be signed in to change notification settings - Fork 164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update documentation on endpoint paths starting with /
#782
Comments
Hi @spras, it looks correct to me that you redefine your endpoints because of the custom base url. This behaviour was mostly inspired by how URL's are resolved in the browser. For example, assuming you are on https://example.com/subpage and you have The fact that using I would suggest you to use fully-specified URLs in path configs, because your usecase (I assume) involves going away from Nuxt to an external custom URL. |
I faced the similar issue. Here is my nuxt.config file. Ensure that the origin ends with a ‘/’. This worked for me.
|
@phoenix-ru your explaination make sense , it'OK for me. I think documentation should be more detailed and explicit on it. |
Thank you for the feedback @spras, we will adjust the documentation accordingly |
/
I've been struggling with this as well when using an external auth server on Example 1 - Incorrect URLauth: {
baseURL: 'http://base-url',
provider: {
endpoints: {
signIn: {path: 'http://api-url/login'},
},
} The sign in path becomes: Example 2 - Incorrect URLAdd the ending slash on baseURL. auth: {
baseURL: 'http://base-url/',
provider: {
endpoints: {
signIn: {path: 'http://api-url/login'},
},
} The sign in path becomes: Example 3 - Incorrect URLDelete baseURL. auth: {
baseURL: '',
provider: {
endpoints: {
signIn: {path: 'http://api-url/login'},
},
} The sign in path becomes: The only solution which works is to define baseURL as my external URL with ending slash, and then use no leading slash on the path config, as seen below. This is the configuration which @phoenix-ru said should be considered a bug. Example 4 - Correct URLauth: {
baseURL: 'http://api-url/',
provider: {
endpoints: {
signIn: {path: 'login'},
},
} The sign in path becomes: I think a more sophisticated solution may be required. Perhaps checking if the endpoint path begins with a scheme (https://) in which case the baseURL is dropped, allowing a fully-specified URL to override the baseURL. |
Hi everyone 👋 I took the following steps to address this issue:
I hope that these steps address this issue for now and that we can find a better solution in #797 to improve the module in the long run! 🥳 |
@coreyshuman Thank you for reporting that, it was definitely overlooked. As @zoey-kaiser outlined, we will do a proper fix so that URLs work as expected and don't feel hacky anymore. |
@phoenix-ru @zoey-kaiser I tried everything but doesn't work for me, still using the default baseURL |
Environment
Darwin
v20.10.0
3.12.2
3.12.0
2.9.6
[email protected]
-
debug
,ssr
,devtools
,runtimeConfig
,modules
,css
,vuetify
,auth
,features
,app
,components
,hooks
,build
[email protected]
,@nuxt/test-utils/[email protected]
,@nuxtjs/[email protected]
,@sidebase/[email protected]
,@vueuse/[email protected]
-
Reproduction
here is my nuxt.config.ts
Describe the bug
I'm currently testing upgrade from 0.7.2 to 0.8.0-rc
This break my config : local provider and auth.baseURL defined to a custom base url ex : https://example.com/
Login is posted to the nuxt base URL , not to my custom base url
As a workaround I had to redefine all the endpoints and removing the / prefix .
Perhaps it has to become the default values ?
It seems to be linked to the modifications for this issue #742 ,
https://github.com/sidebase/nuxt-auth/pull/750/files , joinPathToApiURL function
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: