UNPKG

@coursebuilder/core

Version:

Core package for Course Builder

65 lines (64 loc) 2.13 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/providers/egghead.ts var egghead_exports = {}; __export(egghead_exports, { default: () => egghead }); module.exports = __toCommonJS(egghead_exports); function egghead(config) { return { id: "egghead", name: "egghead", type: "oauth", token: "https://app.egghead.io/oauth/token", authorization: { url: "https://app.egghead.io/oauth/authorize?response_type=code", params: { scope: "" } }, userinfo: { url: "https://app.egghead.io/api/v1/users/current", async request({ tokens, provider }) { const profile = await fetch(provider.userinfo?.url, { headers: { Authorization: `Bearer ${tokens.access_token}`, "User-Agent": "authjs" } }).then(async (res) => await res.json()); return profile; } }, profile(profile) { return { id: profile.id, name: profile.name, email: profile.email, image: profile.avatar_url }; }, clientId: config.clientId, clientSecret: config.clientSecret, allowDangerousEmailAccountLinking: config.allowDangerousEmailAccountLinking }; } __name(egghead, "egghead"); //# sourceMappingURL=egghead.cjs.map