zoukankan      html  css  js  c++  java
  • OAutho2 请求响应格式

    1、OAuth2.PasswordGrant

    REQUEST:
    POST /token HTTP/1.1
    Host: localhost:20006
    Content-Type: application/x-www-form-urlencoded
    Accept: application/json
    Cache-Control: no-cache
    Postman-Token: d4e1197e-e4ba-a706-19db-40664b154799
    
    grant_type=password&client_id=123&client_secret=mysecret&username=myusername&password=mypassword
    
    RESPONSE:
    {
      "access_token": "YTNEaUqPMJosIGirHsaHFHSQ22FFPDAvNV7iK8-6NjdZncn7xmeHAdE4bRtDyzsb7sKxs4LMkaOOvxTsWoKktsT7FTvSJ3_gcc72n8nqUEG-oQ99wzx1nCpCBw0g4QLNd0ohU2Y8d2wDJXkYfmTlBIVlSsAYRNigEUmTvNyfFhuPK8R44Nmt_IJJSZqg7wpLY4ccbvitn78ZCceoa08Z_hZAEdz24uk3FwOMvC0USfA",
      "token_type": "bearer",
      "expires_in": 599
    }

    2、OAuth2.AuthorizationCodeGrant

    REQUEST:
    http://localhost:20001/authorize?response_type=code&client_id=123&scope=myscope&state=mystate&redirect_uri=http://localhost:20001/api/default/AuthorizeCallback
    RESPONSE:
    Your state is = 'mystate' and authorize code is : 'ddd7ca6dde4c4348bf61cd4139f879d8631858e279974b47848fbd6b8cf2136c'
    
    
    REQUEST:
    POST /token HTTP/1.1
    Host: localhost:20001
    Content-Type: application/x-www-form-urlencoded
    Accept: application/json
    Cache-Control: no-cache
    Postman-Token: de7db74e-7ba5-ef11-0e4b-24accda775ad
    
    grant_type=authorization_code&client_id=123&client_secret=mysecret&code=ddd7ca6dde4c4348bf61cd4139f879d8631858e279974b47848fbd6b8cf2136c&redirect_uri=http%3A%2F%2Flocalhost%3A20001%2Fapi%2Fdefault%2FAuthorizeCallback
    
    RESPONSE:
    {
      "access_token": "caJNbVtQgPXtZPEVfejO7T-TJ5TNnBXBPqfrc5xFqGrLh8iZllQoo5BzZU7-xyhJk1euf4oXPl0GuRc8VACGMeQvfFmqhTvQ57vosbDz5BqjrTPNMvI-E-Anv-3INtP198l2BxG13Ct9HwVbqA_ZjktU3NpVnvmxUXZI2upi3hnlBC8v_e8xIT752A0Iel7arN-4tdwRBOT1ldZNhgH2-Z55zQXFMenCDhdj3dYgKCc",
      "token_type": "bearer",
      "expires_in": 599
    }

    摘自:https://github.com/btungut/OAuth2-OWIN-Grants-Examples

  • 相关阅读:
    Linux 文件权限
    spak数据倾斜解决方案
    逻辑时钟
    kafka入门
    深入学习MySQL事务:ACID特性的实现原理
    程序员的诗
    java技术突破要点
    一个请求过来都经历了什么
    如何保持长时间高效学习
    你的系统如何支撑高并发
  • 原文地址:https://www.cnblogs.com/lilunjia/p/7080301.html
Copyright © 2011-2022 走看看