WebClient处理身份验证失败

时间:2020-06-22 09:37:05

标签: oauth spring-webclient

我有一个Spring Web应用程序,我想使用WebClient使用受oauth保护的API。

我想正确处理令牌检索错误。我注意到认证失败时没有返回任何令牌,然后我注意到引发了NullPointerException。我通过定义以下处理程序找到了一种检测这种情况的方法

@Component
export default class Game extends Vue{
  public word = ""
  public words: Array<string> = ["hello", "world"]

  public checkValue(): void{
    const firstWord = this.words.shift();
    if(firstWord === this.word.trim()) {
      console.log("Success")
    }
  }
}

但是我对此解决方案不满意。我还没有找到注册一种身份验证失败处理程序的任何方法。你们中有人知道如何更好地做到这一点吗?

感谢您的帮助 马克

0 个答案:

没有答案