前面三篇文章讲了client credentials、password以及authorization code授权模式,本文就来讲一下implicit模式。
该模式直接在浏览器中向认证服务器申请令牌,无需经过client端的服务器,跳过了”授权码”这个步骤,所有步骤在浏览器中完成,直接在回调url中传递令牌。 适合直接在前端应用获取token的应用
步骤跟authorization code类似,只不过少了授权码:
http://localhost:8080/oauth/authorize?response_type=token&client_id=demoApp&redirect_uri=https://baidu.com
http://localhost:8081/callback#access_token=41f78007-e2ec-4978-9beb-a830b638d4d8&token_type=bearer&expires_in=1199&scope=all
可以发现直接在url中携带了access_token等信息 当然了,使用了implicit模式,其实就没必要使用spring security oauth2的client模块了,因为直接走浏览器模式。