✨ feat: add new route to get client callback
This new route serves to find the client callback after successfully logging in from the provider page. This is done so that the callback becomes more flexible and can be changed at any time.
This commit is contained in:
@ -0,0 +1,14 @@
|
||||
import { getOauthProviders } from "../../../../config/oauthProvider";
|
||||
import { AppError } from "../../../../helpers/error/instances/app";
|
||||
|
||||
export const getCallbackProviderUrlService = async (providerName: string) => {
|
||||
const callbackUrl = getOauthProviders().find(
|
||||
(provider) => provider.name === providerName
|
||||
)?.client_callback;
|
||||
|
||||
if (!callbackUrl) {
|
||||
throw new AppError(404, "The specified provider does not exist.");
|
||||
}
|
||||
|
||||
return callbackUrl;
|
||||
};
|
||||
Reference in New Issue
Block a user