jira.js
    Preparing search index...

    Function parseCallbackUrl

    • Read the authorization code out of the URL Atlassian redirected the user to.

      Handles the three ways this step goes wrong, each of which is easy to forget by hand:

      • The user declined on the consent screen, so the URL carries error=access_denied and no code;
      • state is missing or does not match the one you issued;
      • The URL is simply not a callback — no code, no error.

      Each throws an OAuthError; for a decline, error is access_denied, which isReauthorizationRequired recognises.

      Parameters

      Returns CallbackParams

        const { code } = parseCallbackUrl(request.url, { expectedState: session.oauthState });

      const tokens = await exchangeAuthorizationCode({ clientId, clientSecret, code, redirectUri });