Code Monkey home page Code Monkey logo

Comments (3)

jimblanc avatar jimblanc commented on June 14, 2024 1

@TitusEfferian Glad to hear you got it working! Thank you for your feedback on the documentation structure, we will take that into consideration.

from amplify-js.

cwomack avatar cwomack commented on June 14, 2024

Hello, @TitusEfferian 👋. It looks like you are missing the tokenProvider for your custom auth flow. You'll need to import the TokenProvider from aws-amplify/auth and use that within your Amplify.configure() call like seen here. Doing so should provide you with both the tokens and userSub.

Let me know if that doesn't resolve the issue for you!

from amplify-js.

TitusEfferian avatar TitusEfferian commented on June 14, 2024

Hi @cwomack, thanks for the response. Yes, it's now working as expected. However, as a user who has transitioned from Amplify version 5 to version 6, I feel that the documentation could be improved. In the previous version (v5), performing this action would automatically return tokens:

// get data from auth0
const sync = await getIdTokenClaims();

const cred = await Auth.federatedSignIn(
  "my auth0 domain",
  {
    token: sync?.__raw || "",
    expires_at: (sync?.exp || 0) * 1000,
  },
  {
    name: sync?.name || "",
    email: sync?.email || "",
    picture: sync?.picture || "",
    sub: sync?.sub || "",
   ...add another additional data here
  },
);
const user = await Auth.currentAuthenticatedUser();
// output
{
  "id": "my id",
  "token": "my token"
}

In version 6, I need to undertake additional processes to achieve the same expected result, as you mentioned:

You'll need to import the TokenProvider from aws-amplify/auth and use that within your Amplify.configure() call like seen here. Doing so should provide you with both the tokens and userSub.

This is just my proposal for improvement: perhaps this section could be moved after the Identity Pool Federation section, as they are still related. I didn't realize this additional step was necessary.

image

from amplify-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.