How to get access_token with cozy-stack


Hi, I want to get access_token using POST /auth/access_token.
client_id, client_secret, code are required.
What requests can I get in order after GET /auth/login?

Please let me know if you know anyone.


Hello @moriokatky,

Here’s a sample script that call the API (using curl) to get a token allowing to access to data inside a Cozy:

You have to call /auth/register to get a client_id and a client_secret, then send this tokens to /auth/authorize.
You will get an URL. Opening this URL, your server will ask to authorize your application to access the data. If you agree, your Cozy server will call the URL provided by the application to send it a code. So your application should probably listen on some port on localhost to get the code.

Call /auth/access_token with this code to get the real access_token.

Hope it may help.


Thank you for explaining.
The introduced source is very easy to understand…


This post was flagged by the community and is temporarily hidden.