简体   繁体   English

DJANGO获取访问令牌

[英]DJANGO get access token

When I'm running the first-time log in API using username and password will get the client id and secret. 当我运行第一次使用用户名和密码登录API时,将获得客户端ID和密码。 using o/token api I will get the access token, o/token params are as follows: 使用o / token api我将获得访问令牌,o / token参数如下:

 grant_type=password username={{emailid}} password={{password}} client_id={{client id}} client_secret={{client secret}}

Is it possible to get the access token without using username and password in o/token/ api? 是否可以在不使用o / token / api中的用户名和密码的情况下获取访问令牌? using the only client_id and client secret can I get access token and refresh token??? 使用唯一的client_id和client secret我可以获取访问令牌并刷新令牌吗???

Finally got solution!!!!!! 终于解决了!!!!

We have to use oauth2 client_credentials grant type instead of password type. 我们必须使用oauth2 client_credentials授予类型而不是密码类型。 For more info check this out - https://tools.ietf.org/html/rfc6749#section-4.4 有关更多信息,请查看-https: //tools.ietf.org/html/rfc6749#section-4.4

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM