# NylasConnect.getAuthUrl()

Source: https://developer.nylas.com/docs/v3/auth/nylas-connect/nylasconnect-class/authentication-methods/nylasconnect-getauthurl/

The `getAuthUrl()` method builds an authorization URL for backend-only flows (authentication flows that don't use [PKCE](/docs/v3/auth/hosted-oauth-accesstoken/#secure-the-authentication-process-with-pkce)). This method doesn't store state information or perform a token exchange — it's intended for server-side exchanges using an API key.

```ts
const authData = await nylasConnect.getAuthUrl({
  provider: "google",
  scopes: ["https://www.googleapis.com/auth/gmail.readonly"],
});
console.log("Authorization URL:", authData.url);
```

You can pass the following options to customize the authentication flow.


## Return value

`NylasConnect.getAuthUrl()` returns a `Promise` that resolves to an object with the following properties.

| Property | Type     | Description                                                                                   |
| -------- | -------- | --------------------------------------------------------------------------------------------- |
| `scopes` | string[] | An array of [granular scopes](/docs/dev-guide/scopes/) that Nylas will request from the user. |
| `state`  | string   | A custom value included in the authorization URL for security purposes.                       |
| `url`    | string   | The complete authorization URL that the user is redirected to.                                |