# Migration Guide

This is a basic guide to the different configuration options and how they map between the two versions.

{% tabs %}
{% tab title="@salte-auth/salte-auth@^2.0.0" %}

```javascript
import { SalteAuth } from '@salte-auth/salte-auth';

const auth = new SalteAuth({
  providerUrl: 'https://salte-os.auth0.com',
  responseType: 'id_token token',
  redirectUrl: 'https://salte.io/authorize',
  clientId: 'my-client-id',
  scope: 'openid',
  routes: ['/account'],
  endpoints: [
    'https://api.google.com'
  ],
  provider: 'auth0',
  loginType: 'redirect',
  redirectLoginCallback: function(error) {
    if (error) console.error(error);
  },

  storageType: 'session',

  validation: {
    nonce: false
  },

  autoRefresh: true,
  autoRefreshBuffer: 1000,
  queryParams: {
    audience: 'my-audience'
  }
});

console.log(auth.profile.userInfo);
```

{% endtab %}

{% tab title="@salte-auth/salte-auth@^3.0.0" %}

```javascript
import { SalteAuth } from '@salte-auth/salte-auth';
import { Redirect } from '@salte-auth/redirect';
import { Auth0 } from '@salte-auth/auth0';

const auth = new SalteAuth({
  providers: [
    new Auth0({
      url: 'https://salte-os.auth0.com',

      audience: 'my-audience', // This is a `@salte-auth/auth0` specific parameter.
      responseType: 'id_token token',
      redirectUrl: 'https://salte.io/authorize',
      clientID: 'my-client-id',
      scope: 'openid',

      routes: true,

      endpoints: [
        'https://api.google.com'
      ],

      storage: 'session',

      validation: {
        nonce: false
      },

      renewal: {
        type: 'auto',
        buffer: 1000
      }
    })
  ],

  handlers: [
    new Redirect({
      default: true
    })
  ]
});

auth.on('login', (error, { data: idToken }) => {
  if (error) console.error(error);
  else console.log(idToken.user);
});

console.log(auth.provider('auth0').idToken.user);
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://salte-auth.gitbook.io/salte-auth/support/migration-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
