@@ -85,102 +85,6 @@ export class GuildedStrategy<User> extends OAuth2Strategy<
8585 return params ;
8686 }
8787
88- // async authenticate(
89- // request: Request,
90- // sessionStorage: SessionStorage,
91- // options: AuthenticateOptions,
92- // ): Promise<User> {
93- // // Implementing some logic from sergiodxa/remix-auth-oauth2 here
94- // const session = await sessionStorage.getSession(
95- // request.headers.get("Cookie"),
96- // );
97-
98- // let user: User | null = session.get(options.sessionKey) ?? null;
99- // if (user) {
100- // return this.success(user, request, sessionStorage, options);
101- // }
102-
103- // const params = new URL(request.url).searchParams;
104- // const code = params.get("code");
105- // if (!code) {
106- // const state = generateState();
107- // session.flash("oauth2:state", state);
108-
109- // const authOptions = new URLSearchParams({ state });
110- // if (!("vanity" in this.options)) {
111- // authOptions.set("client_id", this.options.clientId);
112- // }
113- // if (this.options.prompt) {
114- // authOptions.set("prompt", this.options.prompt);
115- // }
116- // if (this.options.redirectUri) {
117- // authOptions.set("redirect_uri", this.options.redirectUri);
118- // }
119- // if (this.options.scope) {
120- // authOptions.set("scope", this.options.scope.join(" "));
121- // }
122-
123- // throw redirect(
124- // `https://authlink.app/${
125- // "vanity" in this.options ? `a/${this.options.vanity}` : "auth"
126- // }${authOptions.size === 0 ? "" : `?${authOptions}` }`,
127- // {
128- // headers: {
129- // "Set-Cookie": await sessionStorage.commitSession(session),
130- // },
131- // },
132- // );
133- // }
134-
135- // const state = params.get("state");
136- // const storedState = session.get("oauth2:state");
137- // if (storedState && state !== storedState) {
138- // throw await this.failure(
139- // "State did not match expected value",
140- // request,
141- // sessionStorage,
142- // options,
143- // );
144- // }
145-
146- // const authResponse = await fetch(`${API_BASE}/token`, {
147- // method: "POST",
148- // body: new URLSearchParams({
149- // client_id: this.options.clientId,
150- // client_secret: this.options.clientSecret,
151- // grant_type: "authorization_code",
152- // code,
153- // }),
154- // headers: {
155- // "Content-Type": "application/x-www-form-urlencoded",
156- // },
157- // });
158- // if (!authResponse.ok) {
159- // throw await this.failure(
160- // `Bad access token response: ${
161- // authResponse.statusText
162- // } - ${await authResponse.text()}`,
163- // request,
164- // sessionStorage,
165- // options,
166- // );
167- // }
168- // const tokenData = (await authResponse.json()) as GuildedAccessTokenResponse;
169- // return this.success(tokenData, request, sessionStorage, options);
170-
171- // // const user = await this.getUser(tokenData.access_token);
172- // // if (user.id) {
173- // // return await this.success(user, request, sessionStorage, options);
174- // // }
175-
176- // // throw await this.failure(
177- // // JSON.stringify(user),
178- // // request,
179- // // sessionStorage,
180- // // options,
181- // // );
182- // }
183-
18488 protected async userProfile ( accessToken : string ) : Promise < GuildedProfile > {
18589 const response = await fetch ( `${ API_BASE } /users/@me` , {
18690 headers : {
0 commit comments