import type { OAuthConfig , OAuthUserConfig } from "." ; export interface FacebookProfile { id : string ; picture : { data : { url : string ; } ; } ; } export default function Facebook < P extends Record < string , any > = FacebookProfile > ( options ) { return { id : "facebook" , name : "Facebook" , type : "oauth" , authorization : "https://www.facebook.com/v11.0/dialog/oauth?scope=email" , token : "https://graph.facebook.com/oauth/access_token" , userinfo : { url : "https://graph.facebook.com/me" , params : { fields : "id,name,email,picture" } , async request ( { tokens , client , provider } ) { return await client . userinfo ( tokens . access_token ! , { params : provider . userinfo ?. params , } ) ; } , } , profile ( profile ) { return { id : profile . id , name : profile . name , email : profile . email , image : profile . picture . data . url , } ; } , options , } ; }