/oauth/authorization/<service> doesnt work when you click on link in browser but works when you enter it in the browser

huangapple go评论58阅读模式
英文:

/oauth/authorization/<service> doesnt work when you click on link in browser but works when you enter it in the browser

问题

所以我似乎无法理解这个...

这可能是什么原因呢?

我的设置:

我在使用 Spring Boot 2.3.3Vaadin 17.0.3 结合。
对于 OAuth,我使用 Spring-Boot-Oauth2。(基本上是这个教程:“https://vaadin.com/learn/tutorials/google-login”)

在 Vaadin 14 上运行良好,但我想在切换到 Vaadin 16 后出现了一些问题... 我正在尝试测试一些东西,但是现在对我来说回滚不是那么容易。

我的 JDK 是 Java 14。

当我尝试点击我的 OAuth 链接之一,例如 "/oauth/authorization/google",我的应用程序返回 404 错误。但是当我在浏览器中输入相同的链接时,它是正常的。

我不知道从哪里开始,但我怀疑这可能与 Vaadin 的 RouterLayout 有关。

有什么想法可能会导致这个问题吗?我不能贴出代码,因为我不知道错误可能在哪里...

如果您需要更多信息,请随时询问。

英文:

So I cant seem to wrap my head around this...

What could possibly the reason for this?

My settings:

Im using Spring Boot 2.3.3 in Combination with Vaadin 17.0.3.
For oauth i use Spring-Boot-Oauth2. (Pretty much this tutorial: "https://vaadin.com/learn/tutorials/google-login")

It worked on Vaadin 14 but i guess after switching to Vaadin 16 something broke... Im trying to test some things, but a rollback isnt that easy for me rn.

My JDK is Java 14.

When Im trying to click on one of my OAuth Links, e.g. &quot;/oauth/authorization/google&quot; , my applicationr returns a 404. But when I enter the same link in the browser it works.

I dont know where to start, but I suspect it has to do something with Vaadins RouterLayout.

Any ideas what might cause this? I cant post code, since I dont know where the error could be...

If you need more information feel free to ask.

答案1

得分: 4

你可以在链接上添加 router-ignore 作为一个属性,这样路由器就不会将其解释为一个应该只触发视图更改而不重新加载页面的内部链接。

因此,你的链接可能是这样的:<a href="/oauth/authorization/google" router-ignore>使用 Google 账号登录</a>

英文:

You can add router-ignore as an attribute on a link to make it so that the router doesn't interpret it as an internal link that should just trigger changing the view without reloading the page.

Your link could thus be something like &lt;a href=&quot;/oauth/authorization/google&quot; router-ignore&gt;Log in with Google&lt;/a&gt;.

huangapple
  • 本文由 发表于 2020年9月24日 18:50:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/64044902.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定