Does anyone know how to get `state` to work in the...
# suitetalkapi
a
Does anyone know how to get
state
to work in the TBA flow? It claims it's returned in Step Two Callback URL. But mine doesn't seem to show up. https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_156536698849.html
b
how do you set it in step 1?
a
I essentially converted a dictionary to query params and uri encoded it.
b
too high level, and its honestly sounds like you are trying to implement oauth 1 yourself
your first attempt should be trying to use a library that supports oauth 1
a
Unfortunately those are far and few between for dotnet core. Everyone it seems except for Netsuite is using the standard OAuth 2 implementation. Which I wish I could use but until they stop expiring refresh tokens automatically with no way of getting a new one I am stuck implimenting OAuth 1. 😞
b
RestSharp is the usual c# based answer
a
Yeah but unfortunately this is a long running project we are integrating into that already has an http client solution we need to keep.
b
umm, prepare to suffer
id at least take a look at how they implemented it
a
Believe me, I am lol
Maybe someday they will fix their OAuth 2 implementation.
b
get a restsharp example up and working
and then compare their header to yours
a
Oh I have it fully working except I was hoping to use the State to share things across requests because the 3rd part you come right from Netsuite and are unauthorized in our app because of it but I think I might just use a cookie.
b
you may have better luck trying OAuth 2.0 Client Credentials Flow. which may not actually be easier if you cant find something that can generate a jwt client assertion
you are supposed to use the state to tell if the user is already logged into your website
not the other way around