Code Monkey home page Code Monkey logo

blog's People

Watchers

 avatar  avatar

blog's Issues

一个"诡异"的oauth权限问题

背景: 后端接口采用oauth授权, node服务端申请到一个帐号, 并被授予权限x, 调用后端某接口. 当node首次启动时, 会用帐号去获取token. 后续在access token(简称AT) 过期之前, 通过refresh token(后续简称RT)获取新的AT.

症状为生产服务器AT偶发丢失权限x, 几分钟后症状自动消失, token未更换. 测试服无法复现问题. 后发现用帐号重新登录一次权限也可以恢复, token仍然是原来的token.

最后终于找到原因, 问题主要出在RT上面. 由于权限x是后续增加的, 获取RT的时候并未获取此权限, 而此RT的有效期又被设为了一年. 当用这个无权限的老RT去刷新AT之后, 新获取的AT也同样没有权限x. 而用帐号重新登录之后, 又会把此时帐号拥有的x权限授予当前的AT. 这个AT仍然是之前用RT刷新得到的AT, 只是登录之后拿到了权限x.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.