Formdata.append error after upgrading to latest version of remix-auth and remix
arunmmanoharan opened this issue · comments
Hi, I upgraded to latest version of remix-auth and remix and keep getting this error only in development mode. It doesnt occur in production.
import { Authenticator } from "remix-auth";
import { sessionStorage } from "~/session.server";
import { MicrosoftStrategy } from "remix-auth-microsoft";
export type User = {
name: string;
email: string;
expiresAt: string;
refreshToken: string;
};
export let authenticator = new Authenticator<User>(sessionStorage);
let microsoftStrategy = new MicrosoftStrategy<User>(
{
clientId: process.env.CLIENT_ID ?? "",
clientSecret: process.env.CLIENT_SECRET ?? "",
tenantId: process.env.TENANT_ID ?? "",
redirectUri: process.env.CALLBACK_URL ?? "",
scope: process.env.SCOPE ?? "",
prompt: "select_account",
},
async ({ refreshToken, extraParams, profile }) => {
const expiresAt = new Date(
Date.now() + extraParams.expires_in * 1000,
).toISOString();
return {
email: profile.emails[0].value,
name: profile.displayName,
expiresAt,
refreshToken,
};
},
);
authenticator.use(microsoftStrategy);
this is my env variables printed out.
Please advice.
Thanks for reporting @arunmmanoharan I've just published version 2.0.1 which has a fix to a issue with remix-auth-oauth2 version 1.11. Can you check if this issue still persists?
Which relevant package versions are you using?
Sorry @juhanakristian . I wasnt passing the offline scope and the authenticator wasnt returning me a refreshToken. Fixed it by adding the default scopes along with a custom scope.