Sign in
Log inSign up
Kelvin Mwinuka

180 likes

·

6.0K reads

6 comments

Rick
Rick
Mar 6, 2023

Great article, learned a lot from it!

I want to make authorized API call to Amplify from the front end, how should I go about that? I tried just calling Auth.currentSession but I believe that works with cookies.

·
·1 reply
Kelvin Mwinuka
Kelvin Mwinuka
Author
·Mar 7, 2023

Hi Rick,

If you're using Amplify auth, then this article is not a good starting point. This article is primarily for integrating your own Auth2.0 solution.

This may be a better starting point for Amplify auth (docs.amplify.aws/lib/auth/getting-started/…)

·
Guilherme Rosa
Guilherme Rosa
Sep 1, 2023

Great article, Kelvin! I have issues with typescript: Property 'accessToken' does not exist on type 'Session'.ts(2339) with .accessToken .idToken and .error . Did you face this issues or did I do something wrong? Thanks.

·
·1 reply
Sina A
Sina A
Dec 22, 2023

To resolve this, you can extend the Session interface in Next-Auth:

declare module "next-auth" { interface Session { user: { accessToken: string; tokenExpiration: number; idToken: string; } & DefaultSession["user"]; error: string; } }

·
Vitor Régis
Vitor Régis
Feb 20, 2024

Brother, I'm so thankful for you and this post. <3

·
Vitor Régis
Vitor Régis
Feb 20, 2024

Fantastic

·