Embed Endpoint Auto creates an approved affiliate

const embedToken = await wretch("https://api.affonso.io/v1/embed/token")
		.headers({
			Authorization: `Bearer ${env.AFFONSO_API_KEY}`,
			"Content-Type": "application/json",
		})
		.post({
			programId: {env.AFFONSO_PROGRAM_ID},
			partner: {
				email: user.email,
			},
			externalUserId: user.id,
		})
		.json((data: { success: boolean; data?: { publicToken: string } }) => {
			return data.data?.publicToken ?? null;
		})
		.catch((error) => {
			console.error("Error fetching Affonso embed token:", error);
			return null;
		});

I am working on using the embedded dashboard in my service and the above code/endpoint creates an affiliate and puts them as approved despite my program being set as private so they should need my approval? It would be good to either not auto enroll them without a parameter in the body of the post & in the returned data to specify their status e.g. not enrolled, pending etc.

I have not seen an endpoint to query for an affiliate by their email which would allow me to circumvent this issue on a check if the user is signed up/ approved. As stated above this endpoint can be improved so a second is not required.

Currently I cannot embed the dashboard due to this bug.

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board

πŸ’‘ Requests & Reports

Tags

Bug Report

Date

29 days ago

Author

Mark Hardwick

Subscribe to post

Get notified by email when there are changes.