Hi there.
I'm trying to implement auth with multiple custom providers.
I have the following code to create a list of providers based on a configuration file
javascript
const providers = connections.map(({ id, authUrl, tokenUrl, clientId, clientSecret, scopes }) => {
return {
id,
get: (redirectURI: undefined | string, authCodeFromRequest: undefined | string) => {
return {
accessTokenAPI: {
url: tokenUrl,
params: {
client_id: clientId,
client_secret: clientSecret,
grant_type: "authorization_code",
redirect_uri: process.env.AUTH_SUCCESS_REDIRECT_URI,
code: authCodeFromRequest || '',
}
},
authorisationRedirect: {
url: authUrl,
params: {
client_id: clientId,
scope: scopes,
response_type: "code",
redirect_uri: process.env.AUTH_SUCCESS_REDIRECT_URI,
}
},
getClientId: () => clientId,
getProfileInfo: async (accessTokenAPIResponse: any) => {
console.log(accessTokenAPIResponse);
return {
id: "...",
};
}
}
}
}
});
I can successfully login with a provider and I can see I can get redirected to the
process.env.AUTH_SUCCESS_REDIRECT_URI
. But the code inside
getProfileInfo
is never called.
Also, I have followed the guide (
https://supertokens.com/docs/thirdparty/common-customizations/getting-provider-access-token) to get the provider access token but that doesn't get called either.
What am I doing wrong?