0

I tried to follow this blog

FOSOAuth Tutorials:

I followed all through his explanations except that I change this:

service:
    user_provider: fos_user.user_manager

to

service:
    user_provider: fos_user.user_provider.username

When I tried to get the auth on oauth/v2/token it tells me that my client is invalid.

{"error":"invalid_client","error_description":"The client credentials are invalid"}

This is my route:

http://lom_api.local/app_dev.php/oauth/v2/token?client_id=22fkr98hnts08ws8o4w8cg4wooogo8ck0gkkcowo4osgssskww&client_secret=e28421fn2aogcg0ccg4ggkk8oowsg840k4okc0wcc08c048sw&grant_type=password&username=admin&password=admin

What might be causing this error? Thanks!

iamjc015
  • 2,127
  • 6
  • 25
  • 61

1 Answers1

4

Your client ID is wrong. It shoudl be 1_22fkr98hnts08ws8o4w8cg4wooogo8ck0gkkcowo4osgssskww

or

2_22fkr98hnts08ws8o4w8cg4wooogo8ck0gkkcowo4osgssskww

The first number is the row id on the Token table.

Carlos
  • 1,411
  • 15
  • 21
  • I think (not sure because is quite long since I realized this) that if you create the client using the console you get the full client_id on the command output. – Carlos Sep 07 '17 at 05:48
  • Yeah, my fault, i actually just used the random_id without realizing the $client->getPublicId() concats id and the random_id. Thank you very much! – iamjc015 Sep 07 '17 at 05:49