在这个页面上,https://github.com/doorkeeper-gem/doorkeeper/wiki/Supported-Features,它提到了对隐式授权的支持。看起来authorizations#create 是我想要的端点,它确实返回了一个access_token,但它没有返回所需的其他参数。
要求
https://localhost/oauth/authorize?client_id=<client_id>&response_type=token&redirect_uri=urn:ietf:wg:oauth:2.0:oob
我被重定向到:
重定向
https://localhost?access_token=<access_token> with the body:
{"resource_owner_id":<user_id>,"scopes":[],"expires_in_seconds":7776000,"application":{"uid":"<client_id>"},"created_at":1484857630}
根据规范,我需要的是带有查询参数的重定向:
https://localhost#access_token=<access_token>&token_type=bearer&expires_in=<seconds>&scope=<scope>
使用“redirect_uri=urn:ietf:wg:oauth:2.0:oob”的测试重定向值是否会改变响应?
还要注意 ? 而不是响应查询参数之前的#。我不确定规范对此有何规定,但 Amazon OAuth2 客户端需要 # 号。
如何让 token_type=bearer 包含在内?
谢谢。