Skip to content

Commit abf597b

Browse files
committed
chore(docs): cleanup netsuite doc page
1 parent 4c4d036 commit abf597b

File tree

1 file changed

+61
-53
lines changed

1 file changed

+61
-53
lines changed

docs/pages/getting-started/providers/netsuite.mdx

Lines changed: 61 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { Code } from "@/components/Code"
55

66
# NetSuite
77

8+
<Callout type="warning">To be released in `[email protected]`</Callout>
9+
810
## Resources
911

1012
- [NetSuite - Creating an Integration Record (OAuth 2.0)](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_157771733782.html#Related-Topics)
@@ -16,11 +18,6 @@ import { Code } from "@/components/Code"
1618

1719
### Callback URL
1820

19-
<Callout>
20-
NetSuite does not support http. When testing locally, you can use a service
21-
like [ngrok](https://ngrok.com) to get a local https URL.
22-
</Callout>
23-
2421
<Code>
2522
<Code.Next>
2623

@@ -36,17 +33,53 @@ https://example.com/auth/callback/netsuite
3633
```
3734

3835
</Code.Svelte>
36+
<Code.Express>
37+
38+
```bash
39+
https://example.com/auth/callback/netsuite
40+
```
41+
42+
</Code.Express>
3943
</Code>
4044

41-
### Userinfo RESTlet
45+
> NetSuite does not support `http://` callback URLs. When testing locally, you can use a service like [ngrok](https://ngrok.com) to get a local `https` URL.
46+
47+
### Environment Variables
48+
49+
```
50+
AUTH_NETSUITE_ID
51+
AUTH_NETSUITE_SECRET
52+
AUTH_NETSUITE_ACCOUNT_ID
53+
```
54+
55+
### Configuration
56+
57+
Before setting up the provider, you will need to ensure the following is setup.
58+
59+
- [Create an Integration Record](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_157771733782.html#procedure_157838925981)
60+
- Uncheck the TBA Auth Flow checkbox.
61+
- Check OAuth 2.0 Auth Flow checkbox.
62+
- Copy and paste the `Callback URL` below into the `Redirect URI` field.
63+
- Then select the scope(s) you want to use.
64+
- **REST Web Services** (`rest_webservices`) - Access to REST Web Services.
65+
- **RESTlets**(`restlets`) - Access to RESTLets.
66+
- **SuiteAnalytics Connect** (`suiteanalytics_connect`) - Access to SuiteAnalytics Connect.
67+
- Add any policies you want to use.
68+
- Application Logo (_Optional_) (Shown to users when they are asked to grant access to your application). - Consent Screen
69+
- Application Terms of Use (_Optional_) - A PDF file that contains the terms of use for your application. - Consent Screen
70+
- Application Privacy Policy (_Optional_) - A PDF file that contains the privacy policy for your application. - Consent Screen
71+
- OAuth 2.0 Consent Policy Preference - This setting determines whether the user is asked to grant access to your application **every time** they sign in or only the **first time** they sign in or **never**.
72+
- **Save** the Integration record.
73+
- The Integration record will be used to generate the `clientId` and `clientSecret` for the provider. **Save the generated values for later**
74+
75+
### Userinfo RESTLet Handler
4276

77+
To use this provider, you'll need to create a userinfo RESTlet in your NetSuite instance.
4378
Our `userinfo` URL needs to be a suitelet or RESTLet URL that gives us the
4479
information about the user. The best bet is to use the `N/runtime` module to
4580
get the basics first. - Here is an example of a RESTlet below. Be sure to
4681
deploy and enable access to "All Roles".
4782

48-
### Example RESTLet Callback Handler
49-
5083
Be sure to deploy and use the **external** RESTLet url of any usage of the URIs.
5184

5285
```js
@@ -55,16 +88,15 @@ Be sure to deploy and use the **external** RESTLet url of any usage of the URIs.
5588
* @NScriptType Restlet
5689
*/
5790
define(["N/runtime"],
58-
@param{runtime} runtimee
5991
(runtime) => {
60-
/**
61-
* Defines the function that is executed when a GET request is sent to a RESTlet.
62-
* @param {Object} requestParams - Parameters from HTTP request URL; parameters passed as an Object (for all supported
63-
* content types)
64-
* @returns {string | Object} HTTP response body; returns a string when request Content-Type is 'text/plain'; returns an
65-
* Object when request Content-Type is 'application/json' or 'application/xml'
66-
* @since 2015.2
67-
*\/
92+
/**
93+
* Defines the function that is executed when a GET request is sent to a RESTlet.
94+
* @param {Object} requestParams - Parameters from HTTP request URL; parameters passed as an Object (for all supported
95+
* content types)
96+
* @returns {string | Object} HTTP response body; returns a string when request Content-Type is 'text/plain'; returns an
97+
* Object when request Content-Type is 'application/json' or 'application/xml'
98+
* @since 2015.2
99+
*/
68100
const get = (requestParams) => {
69101
let userObject = runtime.getCurrentUser();
70102

@@ -100,46 +132,21 @@ define(["N/runtime"],
100132
101133
Above is an example of returning the basic runtime information. Be sure to create a new script record and deployment record. When you save the deployment record, you will get the URLs for your RESTlet, which we will use as the `userinfo` URL.
102134
103-
### Environment Variables
104-
105-
```
106-
AUTH_NETSUITE_ID
107-
AUTH_NETSUITE_SECRET
108-
```
109-
110-
### Configuration
111-
112-
Before setting up the provider, you will need to ensure the following is setup.
113-
114-
- [Create an Integration Record](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_157771733782.html#procedure_157838925981)
115-
- Uncheck the TBA Auth Flow checkbox.
116-
- Check OAuth 2.0 Auth Flow checkbox.
117-
- Copy and paste the `Callback URL` below into the `Redirect URI` field.
118-
- Then select the scope(s) you want to use.
119-
- **REST Web Services** (`rest_webservices`) - Access to REST Web Services.
120-
- **RESTlets**(`restlets`) - Access to RESTLets.
121-
- **SuiteAnalytics Connect** (`suiteanalytics_connect`) - Access to SuiteAnalytics Connect.
122-
- Add any policies you want to use.
123-
- Application Logo (_Optional_) (Shown to users when they are asked to grant access to your application). - Consent Screen
124-
- Application Terms of Use (_Optional_) - A PDF file that contains the terms of use for your application. - Consent Screen
125-
- Application Privacy Policy (_Optional_) - A PDF file that contains the privacy policy for your application. - Consent Screen
126-
- OAuth 2.0 Consent Policy Preference - This setting determines whether the user is asked to grant access to your application **every time** they sign in or only the **first time** they sign in or **never**.
127-
- **Save** the Integration record.
128-
- The Integration record will be used to generate the `clientId` and `clientSecret` for the provider. **Save the generated values for later**
135+
### Example Usage
129136
130137
<Code>
131138
<Code.Next>
132139
133-
```ts filename="/auth.ts"
140+
```ts filename="@auth.ts"
134141
import NextAuth from "next-auth"
135142
import NetSuite from "next-auth/providers/netsuite"
136143

137144
export const { handlers, auth, signIn, signOut } = NextAuth({
138145
providers: [
139146
NetSuite({
140-
clientId: AUTH_NETSUITE_ID,
141-
clientSecret: AUTH_NETSUITE_SECRET,
142-
issuer: AUTH_NETSUITE_ACCOUNT_ID, // EX: TSTDRV1234567 or 81555 for prod, and 1234567-SB1 for Sandbox accounts not "_" use "-".
147+
clientId: process.env.AUTH_NETSUITE_ID,
148+
clientSecret: process.env.AUTH_NETSUITE_SECRET,
149+
issuer: process.env.AUTH_NETSUITE_ACCOUNT_ID, // EX: TSTDRV1234567 or 81555 for prod, and 1234567-SB1 for Sandbox accounts not "_" use "-".
143150
// Returns the current user using the N/runtime module. This url can be a suitelet or RESTlet (Recommended)
144151
// Using getCurrentUser(); So we match this schema returned from this RESTlet in the profile callback. (Required)
145152
userinfo:
@@ -158,13 +165,14 @@ export const { handlers, auth, signIn, signOut } = NextAuth({
158165
```ts filename="/src/auth.ts"
159166
import { SvelteKitAuth } from "@auth/sveltekit"
160167
import NetSuite from "@auth/sveltekit/providers/netsuite"
168+
import { env } from "$env/dynamic/private"
161169

162170
export const { handle, signIn, signOut } = SvelteKitAuth({
163171
providers: [
164172
NetSuite({
165-
clientId: AUTH_NETSUITE_ID,
166-
clientSecret: AUTH_NETSUITE_SECRET,
167-
issuer: AUTH_NETSUITE_ACCOUNT_ID, // EX: TSTDRV1234567 or 81555 for prod, and 1234567-SB1 for Sandbox accounts not "_" use "-".
173+
clientId: env.AUTH_NETSUITE_ID,
174+
clientSecret: env.AUTH_NETSUITE_SECRET,
175+
issuer: env.AUTH_NETSUITE_ACCOUNT_ID, // EX: TSTDRV1234567 or 81555 for prod, and 1234567-SB1 for Sandbox accounts not "_" use "-".
168176
// Returns the current user using the N/runtime module. This url can be a suitelet or RESTlet (Recommended)
169177
// Using getCurrentUser(); So we match this schema returned from this RESTlet in the profile callback. (Required)
170178
userinfo:
@@ -189,9 +197,9 @@ app.use(
189197
ExpressAuth({
190198
providers: [
191199
NetSuite({
192-
clientId: AUTH_NETSUITE_ID,
193-
clientSecret: AUTH_NETSUITE_SECRET,
194-
issuer: AUTH_NETSUITE_ACCOUNT_ID, // EX: TSTDRV1234567 or 81555 for prod, and 1234567-SB1 for Sandbox accounts not "_" use "-".
200+
clientId: process.env.AUTH_NETSUITE_ID,
201+
clientSecret: process.env.AUTH_NETSUITE_SECRET,
202+
issuer: process.env.AUTH_NETSUITE_ACCOUNT_ID, // EX: TSTDRV1234567 or 81555 for prod, and 1234567-SB1 for Sandbox accounts not "_" use "-".
195203
// Returns the current user using the N/runtime module. This url can be a suitelet or RESTlet (Recommended)
196204
// Using getCurrentUser(); So we match this schema returned from this RESTlet in the profile callback. (Required)
197205
userinfo:

0 commit comments

Comments
 (0)