Search code examples
djangopython-3.xoauth-2.0clientaccess-token

DJANGO oauth2 grant_type client_credentials


I have implemented oauth2 using client_credentials gran_type. While generating access token(using o/token/ api) user id is not linked with access_token model , user field is null. so I'm not able to access any other api's using access token getting 403 forbidden error.

Any suggestion and help would be appreciable.


Solution

  • The client credentials grant type is used by the client to access the server resources using client ID and client secret but NOT on behalf of any users. The tokens generated are for different devices that are running the client application and have nothing to do with the user of the application. For User Authentication you must use password or convert_token grant type as suitable.

    Read about client credentials at http://oauth.com/oauth2-servers/access-tokens/client-credentials