Getting error while performing external auth

I am trying to integrate a 3rd party product using its API which supports Oauth 2.0 into my Forge app. I am facing below error after the redirection from the 3rd party platform.

Provider config in manifest file:

providers:
  auth:
    - key: oauthprovider
      name: OauthProvider
      scopes:
        - "offline_access"
      type: oauth2
      clientId: fasdfgasdfasd
      remotes:
        - ls-apis
      bearerMethod: authorization-header
      actions:
        authorization:
          remote: ls-home
          path: /authorize-app/asdfasdfasdfsdfgsdfg
        exchange:
          remote: ls-apis
          path: /api/integrations/oauth/token
        retrieveProfile:
          remote: ls-apis
          path: /
          function: ls-profile

I am using a dynamic profile retriever function, below is the code for that.

import { AuthProfile } from "@forge/response";

export const retriever = (response) => {
  console.log("profile response ==>", response);
  return new AuthProfile({
    id: "sdfsfd",
    displayName: "test123123@oauthprovider.com",
  });
};

I checked app logs where there is no message being logged so the above function is not getting called.
Any suggestions would be helpful.

Hi @SagarGujarati ,

Under retrieveProfile you have the path property set to / which doesn’t look right. I’m not familiar with the system you are integrating with, bit for Spotify, you would enter /v1/me for the path. See https://developer.spotify.com/documentation/web-api/reference/get-current-users-profile.

Regards,
Dugald

1 Like

@dmorrow The product API has no specific endpoint for fetching the profile details. It has a GraphQL API that only allows POST calls.

Hi @SagarGujarati ,

I’m not sure if there is a workaround for that.

Regards,
Dugald