Last active
December 15, 2016 09:54
-
-
Save nono/57f6d472afff6a570a5f1c477d2e79a3 to your computer and use it in GitHub Desktop.
Command line to test the creation of an OAuth2 client with the new cozy stack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cozy@cozy-stack-v2:~$ ./cozy-stack instances add test.bruno.fr | |
INFO[0000] Instance created with success for domain test.bruno.fr | |
INFO[0000] Registration token: "37cddf40d7724988860fa0e03efd30fe" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cozy@cozy-stack-v2:~$ http -v --form POST :8080/register Host:test.bruno.fr registerToken=37cddf40d7724988860fa0e03efd30fe passphrase=azerty | |
POST /register HTTP/1.1 | |
Accept: */* | |
Accept-Encoding: gzip, deflate | |
Connection: keep-alive | |
Content-Length: 64 | |
Content-Type: application/x-www-form-urlencoded; charset=utf-8 | |
Host: test.bruno.fr | |
User-Agent: HTTPie/0.8.0 | |
registerToken=37cddf40d7724988860fa0e03efd30fe&passphrase=azerty | |
HTTP/1.1 303 See Other | |
Content-Length: 0 | |
Content-Type: text/plain; charset=utf-8 | |
Date: Thu, 15 Dec 2016 09:07:11 GMT | |
Location: https://onboarding.test.bruno.fr/ | |
Set-Cookie: cozysessid=AAAAAFhSXT81MWU0ZTBiMzllMmI1OGUyMmZiN2Q0YTYzNDAxN2Y5NjCmp2Ja56hPgHwufpJCBBGJC2mLeJ5LCRrFFkHwaVVa; Path=/; Domain=test.bruno.fr; Max-Age=604800; HttpOnly; Secure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cozy@cozy-stack-v2:~$ http -v POST :8080/auth/register Host:test.bruno.fr Content-Type:application/json 'redirect_uris:=["https://client.example.org/oauth/callback"]' client_name=client software_id=github.com/example/client | |
POST /auth/register HTTP/1.1 | |
Accept: application/json | |
Accept-Encoding: gzip, deflate | |
Connection: keep-alive | |
Content-Length: 133 | |
Content-Type: application/json | |
Host: test.bruno.fr | |
User-Agent: HTTPie/0.8.0 | |
{ | |
"client_name": "client", | |
"redirect_uris": [ | |
"https://client.example.org/oauth/callback" | |
], | |
"software_id": "github.com/example/client" | |
} | |
HTTP/1.1 201 Created | |
Content-Length: 625 | |
Content-Type: application/json; charset=utf-8 | |
Date: Thu, 15 Dec 2016 09:21:13 GMT | |
{ | |
"client_id": "51e4e0b39e2b58e22fb7d4a63401850d", | |
"client_name": "client", | |
"client_secret": "hps2RwGhNVzkEOZN-JcDRX80Xg1IFMhr", | |
"client_secret_expires_at": 0, | |
"grant_types": [ | |
"authorization_code", | |
"refresh_token" | |
], | |
"redirect_uris": [ | |
"https://client.example.org/oauth/callback" | |
], | |
"registration_access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZWdpc3RyYXRpb24iLCJpYXQiOjE0ODE3OTM2NzMsImlzcyI6InRlc3QuYnJ1bm8uZnIiLCJzdWIiOiI1MWU0ZTBiMzllMmI1OGUyMmZiN2Q0YTYzNDAxODUwZCJ9.xNflXrtjwRxxpUvMBXotkPB8l9Oltlc--hohkAYgOQNBI1vawZa5pj6kXRT8JC4xpv1qc0SCCTINRKIKKyn82Q", | |
"response_types": [ | |
"code" | |
], | |
"software_id": "github.com/example/client" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cozy@cozy-stack-v2:~$ http -v --form POST :8080/auth/access_token grant_type=authorization_code code=51e4e0b39e2b58e22fb7d4a634019fa8 client_id=51e4e0b39e2b58e22fb7d4a63401850d client_secret=hps2RwGhNVzkEOZN-JcDRX80Xg1IFMhr scope=files:read Host:test.bruno.fr | |
POST /auth/access_token HTTP/1.1 | |
Accept: */* | |
Accept-Encoding: gzip, deflate | |
Connection: keep-alive | |
Content-Length: 176 | |
Content-Type: application/x-www-form-urlencoded; charset=utf-8 | |
Host: test.bruno.fr | |
User-Agent: HTTPie/0.8.0 | |
grant_type=authorization_code&code=51e4e0b39e2b58e22fb7d4a634019fa8&client_id=51e4e0b39e2b58e22fb7d4a63401850d&client_secret=hps2RwGhNVzkEOZN-JcDRX80Xg1IFMhr&scope=files%3Aread | |
HTTP/1.1 200 OK | |
Content-Length: 643 | |
Content-Type: application/json; charset=utf-8 | |
Date: Thu, 15 Dec 2016 09:52:32 GMT | |
{ | |
"access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODE3OTU1NTIsImlzcyI6InRlc3QuYnJ1bm8uZnIiLCJzdWIiOiI1MWU0ZTBiMzllMmI1OGUyMmZiN2Q0YTYzNDAxODUwZCIsInNjb3BlIjoiZmlsZXM6cmVhZCJ9.ctH03reuSDxF3-jCbL-63lB3CFouag8_Jd4lJTxbTY1szvrQx00WctOD6PR7o4l0OTrAz2QXUd0GlY2_OB43mQ", | |
"refresh_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZWZyZXNoIiwiaWF0IjoxNDgxNzk1NTUyLCJpc3MiOiJ0ZXN0LmJydW5vLmZyIiwic3ViIjoiNTFlNGUwYjM5ZTJiNThlMjJmYjdkNGE2MzQwMTg1MGQiLCJzY29wZSI6ImZpbGVzOnJlYWQifQ.ErzlUxqlk9Uo71HjTrjt0qIs766EaIBqAI51TSs15fVV3Yr8yraXfRmPtPGy8cJubIVkSPGIeJFuBaIBCwy80g", | |
"scope": "files:read", | |
"token_type": "bearer" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cozy@cozy-stack-v2:~$ http -v --form POST :8080/auth/access_token grant_type=refresh_token refresh_token=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZWZyZXNoIiwiaWF0IjoxNDgxNzk1NTUyLCJpc3MiOiJ0ZXN0LmJydW5vLmZyIiwic3ViIjoiNTFlNGUwYjM5ZTJiNThlMjJmYjdkNGE2MzQwMTg1MGQiLCJzY29wZSI6ImZpbGVzOnJlYWQifQ.ErzlUxqlk9Uo71HjTrjt0qIs766EaIBqAI51TSs15fVV3Yr8yraXfRmPtPGy8cJubIVkSPGIeJFuBaIBCwy80g client_id=51e4e0b39e2b58e22fb7d4a63401850d client_secret=hps2RwGhNVzkEOZN-JcDRX80Xg1IFMhr scope=files:read Host:test.bruno.fr | |
POST /auth/access_token HTTP/1.1 | |
Accept: */* | |
Accept-Encoding: gzip, deflate | |
Connection: keep-alive | |
Content-Length: 430 | |
Content-Type: application/x-www-form-urlencoded; charset=utf-8 | |
Host: test.bruno.fr | |
User-Agent: HTTPie/0.8.0 | |
grant_type=refresh_token&refresh_token=eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJyZWZyZXNoIiwiaWF0IjoxNDgxNzk1NTUyLCJpc3MiOiJ0ZXN0LmJydW5vLmZyIiwic3ViIjoiNTFlNGUwYjM5ZTJiNThlMjJmYjdkNGE2MzQwMTg1MGQiLCJzY29wZSI6ImZpbGVzOnJlYWQifQ.ErzlUxqlk9Uo71HjTrjt0qIs766EaIBqAI51TSs15fVV3Yr8yraXfRmPtPGy8cJubIVkSPGIeJFuBaIBCwy80g&client_id=51e4e0b39e2b58e22fb7d4a63401850d&client_secret=hps2RwGhNVzkEOZN-JcDRX80Xg1IFMhr&scope=files%3Aread | |
HTTP/1.1 200 OK | |
Content-Length: 342 | |
Content-Type: application/json; charset=utf-8 | |
Date: Thu, 15 Dec 2016 09:54:31 GMT | |
{ | |
"access_token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJhY2Nlc3MiLCJpYXQiOjE0ODE3OTU2NzEsImlzcyI6InRlc3QuYnJ1bm8uZnIiLCJzdWIiOiI1MWU0ZTBiMzllMmI1OGUyMmZiN2Q0YTYzNDAxODUwZCIsInNjb3BlIjoiZmlsZXM6cmVhZCJ9.UV29FJDLU6AAKzz-2WmV7YLWW-Mho2r-kqScNjF2hueB70f8FdwNp89hRPLDp4JAT3XpFaxDFnp4UyHvgQLFQg", | |
"scope": "files:read", | |
"token_type": "bearer" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment