[Feature Request] make redirect_uri work until gitlab fix their issue.
See original GitHub issueWhat problem does the feature solve?
gitlab oauth should work from any static page. Not just from the document root.
Problem: Currently gitlab oauth workflow is not working when user from a static website try to comment on a particular page other than the root page. This issue was already reported here. But it was closed citing this gitlab issue
Proposed solution
The default redirect_uri=
value sent by Vssue to GitLab is window.location.href
without [prefix]
, Instead of sending window.location.href
, why not send redirect_uri=window.locaiton.origin
with state
property containing base64 encoded object with original state
and local redirect_uri
where this internal redirect_uri
should contain window.location.href
, so when oath completes, Vssue can check for redirect_uri
in state
and again redirect to the original url which initiated the oauth request.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (1 by maintainers)
As @meteorlxy mentioned in another issue (https://github.com/meteorlxy/vssue/issues/76), this needs to be applied to all APIs. Passing the current URL as a Base64 string could work for all of them instead of passing the current URL encoded.
I think because we are passing the state into Base64, we may not need to encode it first. (Base64 will accept any single byte characters and any non ASCII characters should already be encoded by the browser as it would be an invalid URL otherwise?) As I previously mentioned, I am using this in an SPA with vue-router in hash mode (Vuelog). Although having vue-router work in history mode might help somewhat, many static hosting will not allow changing parameters for doing a catch-all redirect. (See https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations for more info.) Even so, we need to make sure Vssue works in both modes.
Another consideration is that the window.location.origin without the full state loaded may not include the Vssue component so if Vssue is responsible for handling the state and going back to the original page, it may not work as intended. In that case, a new route for should be added and used as the routing for Vssue OAuth requests. An alternative would be to have a Vssue stub component to handle this on another page even if it doesn’t allow comments but that seems messier.
@cybermoloch I did some fix to my patch to make sure hash string is not omitted after redirection. Kindly check if it works for you now.