cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Not able to create auth2 client token

Former Member
0 Likes
940

Trying to up the rest webservice so have installed and initialize Hybris 6.5.0.7 B2C. Then I checked localextention.xml by default ycommercewebservices is there. Then I created client id(auth2) PFA Then I access "https://localhost:9002/rest/v2/electronics/catalogs" got the response. Then I access "https://localhost:9002/authorizationserver/oauth/token?client_id=clientID1&client_secret=123456&gran..." not working. response : Request method 'GET' not supported method_not_allowed Then i access "https://localhost:9002/rest/v2/electronics/users/" not working. There is no resource for path /rest/v2/electronics/users UnknownResourceError
Based on my analysis i suspected this issue may be beacuse client Id(auth2 client id) creation.

Please advice

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member747843
Active Participant
0 Likes

Hi
When you ask for oauth token you should use POST not GET (that's why you get error Request method 'GET' not supported method_not_allowed )
Try POST on https://localhost:9002/authorizationserver/oauth/token?client_id=clientID1&client_secret=123456&gran...

Sample calls you can find here : https://help.hybris.com/6.5.0/hcd/8c5efdf686691014a9ddddb7ea19b193.html

Former Member
0 Likes

Hi Kinga,

Thanks for input.

Now i have used "Post Man" tool to create the post method. now i am able to create the token. But when i try to create the user with the token facing the access denied error.

Can you please help me on this.

Thanks Kabilan

former_member747843
Active Participant
0 Likes

Creating user is available for { "ROLE_CLIENT", "ROLE_TRUSTED_CLIENT", "ROLE_CUSTOMERMANAGERGROUP" }) so you need token for client or customer manager to be able to register new user.

To get token for client you need set grant_type=client_credentials so something like this : POST on https://localhost:9002/authorizationserver/oauth/token?client_id=clientID1&client_secret=123456&gran...

To make it work with previous token : user john.doe@mail.com should belong to customermanagergroup (then should have ROLE_CUSTOMERMANAGERGROUP)

Former Member
0 Likes

Hi Kinga,

Thanks for the inputs you provided. Now i am able to create the user with webservices.

Thanks, Kabilan

Former Member
0 Likes

Hi Kabilan,

You have to assign the ROLE also.

Because not all resources can be accessed by a normal user.

To get all users,

assign ROLE_CUSTOMERGROUP ,ROLE_CUSTOMERMANAGERGROUP,ROLE_TRUSTED_CLIENT

Thanks Sid

Former Member
0 Likes

Hi Sid,

Thanks for response. Still i am unable to create the token. I am using (https://localhost:9002/authorizationserver/oauth/token?client_id=clientID1&client_secret=123456&gran...) this URL to get token.

Can you please correct me if i am wrong.

Thanks Kabilan

Former Member
0 Likes

Hi Kabilan,

In your OAuth client, assign authorities as :

'ROLE_CUSTOMERGROUP ,ROLE_CUSTOMERMANAGERGROUP,ROLE_TRUSTED_CLIENT .

Former Member
0 Likes

Hi Sid,

Thanks for input.

Kindly look the latest comment on Kinga post.

Regards, Kabilan