ERROR 45001 How to resolve

How to resolve error: provider_code_request_failed 45001 400 Provider refused to return refresh_token using code (hosted auth) Provider??? no have solution

Hello @lcscamacho could you please provide your source so that I can take a look? Also the full error that you’re getting…

Microsoft, im trying this and get error 45001 from microsoft provider: const authUrl = nylas.auth.urlForOAuth2({
clientId: config.clientId,
provider: ‘microsoft’,
redirectUri: config.callbackUri,
loginHint: ‘email_to_connect’,
})

Have you created your connector? Start using the Nylas Sandbox | Nylas Docs

Also, here’s a Microsoft guide on our docs Use Microsoft accounts and data with Nylas | Nylas Docs

1 Like

i m following this guide Create grants with OAuth and an API key | Nylas Docs and this video https://www.youtube.com/watch?v=8luB4dJggtI&list=PLk-4iahO3b-xd42-RL4DJQyuEoFFYwTbC&index=80

I see…I did followed the video as well :sweat_smile: although it worked for me…could you post your source code? No need to post any keys obviously…just want to see what’s going wrong…which SDK are you using?

Also, have you tried with our QuickStart guides? Email API Quickstart: read and send email messages | Nylas Docs

yess, of course! this code: interface AuthInNylasToGetGrantIdProps {

urlCallback: string;
provider?: “google” | “microsoft”;
}
export const authInNylasToGetGrantId = async ({
urlCallback,
provider = “google”,
}: AuthInNylasToGetGrantIdProps) => {
const config = {
clientId: nylasConfigValidated.clientId,
callbackUri: urlCallback,
apiKey: nylasConfigValidated.apiKey,
apiUri: “https://api.us.nylas.com”,
};
const nylas = new Nylas({
apiKey: config.apiKey,
apiUri: config.apiUri,
});

const authUrl = nylas.auth.urlForOAuth2({
clientId: config.clientId,
provider,
redirectUri: config.callbackUri,
state: provider,
});

return { url: authUrl };
};

Thanks @lcscamacho I will take a look and let you know…it’s already nighttime for me :slight_smile:

good morning !! oh yes i wait

A couple of things…if you’re using Microsoft, you should mention Google at all…

Have you registered your callbackUri on the dashboard?

Otherwise, I don’t anything wrong with your code :thinking:

Again, have you take a look at this? Email API Quickstart: read and send email messages | Nylas Docs

I need sendo emails from Outlook of my client!