Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad Request #2

Open
minohimself opened this issue Nov 27, 2016 · 15 comments
Open

Bad Request #2

minohimself opened this issue Nov 27, 2016 · 15 comments

Comments

@minohimself
Copy link

Hi guys, im using nop3.8 and followed the steps and getting Bad Request error.

What could be wrong ?

@poyker
Copy link
Member

poyker commented Dec 19, 2016

@minohimself

It could be everything.
On which step did you get this error?

@RobertCarlaw
Copy link

Hi,

I've managed to install the plugin into Nop (3.90), I've created a Api client in the nop admin at: /Plugins/ManageClientsAdmin/

Now using the Sample application I've entered the details, copying them from the nop admin.

Whenever I hit 'GetAccessToken' from the sample application I get a 400 bad request. Which is failing on
OAuthController.Authorize on the If statement checking for a 200.

I've attached the following images which may help. I've also tried removing slashes and running through IIS but still get the same error.

Any ideas?

api client nop
sample app

@RobertCarlaw
Copy link

Ok it was a config error, The callback URL in nop needs to have '/token' at the end.
Once I'd made this change it all works.

@DarshitThakkar23
Copy link

DarshitThakkar23 commented Jun 14, 2017

When i try to send webRequest using AuthorizeClient method i get 400 bad request error. i have attached following images. Please help. Thanks.(NopCommerce Version 3.90)
image1
image2
image3

@RobertCarlaw
Copy link

Not sure, your config looks correct.

  • make sure the Api Client is active

Put a break point in the NopCommerce plugin - Nop.Plugin.Api.Controllers.OAuth.OAuthController.Authorize method see if it's hitting it.

@DarshitThakkar23
Copy link

Thanks for the reply. Now i am able to access get customers method. just restart the vs2015, clean and rebuilt solution(NopCommerce) and it works.

@RobertCarlaw
Copy link

RobertCarlaw commented Jun 21, 2017 via email

@lculjak
Copy link

lculjak commented Aug 22, 2017

is it possible that after sometime inactive I get /oauth/authorize response BadRequest 'Bad Request' ?

if I deploy the website, the error is fixed, but then is back.

@RobertCarlaw
Copy link

HI,

Not 100% sure, After a period of time the access token will expire, I don't think it should return a bad request response.
Have you implemented the refresh token?

@poyker
Copy link
Member

poyker commented Aug 24, 2017

@RobertCarlaw
Yes, the refresh token is implemented and there is sample code in the Sample Application that shows you how to obtain a refresh token.

@lculjak
Copy link

lculjak commented Aug 24, 2017

I am using the snipet sugested in SevenSpikes/api-plugin-for-nopcommerce#31
is there any issue to get a new token every time that I need to call the API ?
I understand that it may have some performance degradation, but in this case it is not an issue.

@poyker
Copy link
Member

poyker commented Aug 24, 2017

@lculjak

Don't see any issues but if you already have a token then there is no real need to obtain a new one until the current one is valid. So you should get a new token (preferably using the refresh token) only when the current access token is expired in which case you will get 401 Unauthorized response when trying to access any of the endpoints.

@lculjak
Copy link

lculjak commented Aug 29, 2017

I think that I found the reason for the Bad Request status code. My callback url is http://localhost:19890/token but using RestSharp I don't need to setup that url.
If I setup call back url to http://localhost:19890/ it is working. I will continue checking if there is any error later.

@archie7484
Copy link

I don't know what's going on, I'm in the same problem and this is getting hopeless.

This is the setup:

response0

This is the response inside nopCommerce:

response1

Anybody Please help...

@poyker
Copy link
Member

poyker commented Jan 29, 2018

@archie7484

You should remove the /en at the end of the Server URL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants