Created a button and set up a login workflow to trigger user sign in via OAuth2 - Quickbook.
Received the below error when a login was attempted.
Since sign in via social login did not work. I thought I’ll set it up manually.
a. created a button to navigate to the auth URL when clicked. The server returned realmid and code.
b. Setup a post call to retrieve access tokens using the generated code, but cannot manage to bypass the error. Below is how I have it setup currently.
I also tried adding the params in the URL as querystring. But nothing helped, it returned 400 - INvalid Request. The same thing works like a charm via a curl request and in postman.
I have currently run out of my wits and need help in setting this up. I specifically want to do this without a plugin Here is the link to QB OAUth2 documentation in case needed.
I know the frustration. It took a few weeks to set up everything we needed in quickbooks after the initial connection. But at least getting the initial connection was a sigh of relief. Hope we can help you get there.
Thank you for responding. I did take a look at your post before posting, but couldn’t find anything different in mine. But I can definitely use some help here. Well, to answer your question; to begin with I’d do it for new users and eventually look at existing ones.
Then use this instead of parameters. I know it doesn’t make sense, but when I do the parameters any other way it doesn’t seem to work. Let me know if that helps.
For the client ID and secret, you have encoded it correctly? No extra spaces in there? Sometimes when copying and pasting there might be an extra space. Just double check that too.
I get the same exact error when I add an extra character or a space to the Authorization. Hmm Maybe just try deleting it and adding it back again to be extra sure.
When I was checking mine, I put it in a text editor so I could see the whole value then pasted it from there. Besides that, everything else looks good so far. Once we get past this error there might be another one. We just won’t know until this error is fixed.
I have validated the string, ensured there are not extra characters / spaces. Re-generated the base64 encoded string, but no luck. I still get the 401 invalid client error. Weird…
Anything else I could try?
Appreciate you brainstorming with me on this. Thank you very much.
Some things to consider
A) Be sure to have none/selfhandled in Auth part.
B) Better to start from a fresh new API and API Call. Sometimes, things get corrupted in API Connector from some field added/filled/deleted and same with the Auth part if this is not cleaned up totally. So better to start from a totally new API and call to be sure it’s not the case.
C)Don’t forget to also save the RealmID from the url with the returned code. This is needed in most call.
Why don’t you use a page of your app for your redirect url? Normally you should point the redirect to a page and use Get data from page URL. One for code, one for RealmID.
The issue is with the state you are sending. Try sending a random string along as the state instead of state=state.
I would try that and see if it helps. It is for security reasons for you to check that it is the same state you are sending. Prevents cross traffic hacking. Does that make sense?
You can add a condition to check the state when it comes back to make sure it’s the same. First get it working without the error, then you can put the condition on there.
Defines the state between your authorization request and the Intuit OAuth 2.0 Server response.
The state field is used for validation. It checks if the client (i.e. your app) gets the data back that it sent in the original request. Meaning, the state is maintained from send to response.
You can enter any string value for the state. The server should return the exact state : value pair sent in the original request.
Tip: We strongly recommend you include an anti-forgery token for the state and confirm it in the response. This prevents cross-site request forgery. Learn more about CSRF.