i tried out sylius api oauth on complete new sylius project(0.17.0). on every simple api-call valid access-token, response 301 redirect route "/connect".
what did:
1. creating api client:
php app/console sylius:oauth-server:create-client --grant-type="password"
output:
"a new client public id 3ogfp09nbikg440ssg4ss84k4ww4wgw00gc8w4kksskggoocso, secret 4vawhwsg4hwk8gocgk08ogkcgwgswo0k0og0w0cgkk8g8cgsg4 has been added"
2. token:
curl http://www.domain.dev/oauth/v2/token \ -d "client_id"=3ogfp09nbikg440ssg4ss84k4ww4wgw00gc8w4kksskggoocso \ -d "client_secret"=4vawhwsg4hwk8gocgk08ogkcgwgswo0k0og0w0cgkk8g8cgsg4 \ -d "grant_type"=password \ -d "username"=myvalidusername \ -d "password"=myvalidpassword
everything works fine:
{ "access_token":"mduxzwq4m2u0zmjmnteyztdkndrlmjkxy2e3mte2ztm0zdvkzjmwzjeynjriowzlmtdkmmjkota1zmfingfmma", "expires_in":3600, "token_type":"bearer", "scope":null, "refresh_token":"nwnmzjkwntm1mwnimdu5owvhn2njogq5n2u5mgfiytkxywvlymnindbkntjlnzjjzje1mzi1mji5mzi2ytc3nw" }
3. making simple api-call using authorization token http header:
curl http://www.domain.dev/api/users/ -h "authorization: bearer mduxzwq4m2u0zmjmnteyztdkndrlmjkxy2e3mte2ztm0zdvkzjmwzjeynjriowzlmtdkmmjkota1zmfingfmma"
output is:
<!doctype html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="refresh" content="1;url=http://www.domain.dev/connect" /> <title>redirecting http://www.domain.dev/connect</title> </head> <body> redirecting <a href="http://www.domain.dev/connect">http://www.domain.dev/connect</a>. </body> </html>
Comments
Post a Comment