How to use the aws-amplify.Auth.currentSession function in aws-amplify

To help you get started, we’ve selected a few aws-amplify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-samples / aws-mobile-appsync-chat-starter-angular / src / app / chat-app / chat / chat.component.ts View on Github external
ngOnInit() {
    Auth.currentSession().then(session => {
      this.logInfoToConsole(session);
      this.session = session;
      this.register();
      setImmediate(() => this.createUser());
    });

    this.swUpdate.available.subscribe(event => {
      console.log('[App] Update available: current version is', event.current, 'available version is', event.available);
      this.update = true;
    });
  }
github pjay79 / BarsAppAmplify / app / screens / BarsScreen.js View on Github external
getUser = async () => {
    try {
      const session = await Auth.currentSession();
      console.log(session);
    } catch (error) {
      console.log(error);
    }
  };
github ACloudGuru-Resources / Course-The_Complete_Serverless_Course / section-4 / basic-website-aws / frontend / src / App.js View on Github external
componentDidMount() {
    Auth.currentSession()
      .then((response) => {
        this.setApplicationUser(response);
      })
      .catch((error) => {
        //console.error(error)
      });
  }
github aws-samples / aws-bookstore-demo-app / assets / src / App.tsx View on Github external
async componentDidMount() {
    try {
      if (await Auth.currentSession()) {
        this.userHasAuthenticated(true);
      }
    }
    catch(e) {
      if (e !== 'No current user') {
        alert(e);
      }
    }
  
    this.setState({ isAuthenticating: false });
  }
github awslabs / aws-multi-account-viewer / Front-End / src / App.js View on Github external
custom_header: async () => {
          return { Authorization: (await Auth.currentSession()).idToken.jwtToken };
        }
      }
github aws-samples / aws-amplify-graphql / src / App.js View on Github external
    jwtToken: async () => (await Auth.currentSession()).getAccessToken().getJwtToken(),
  },
github pjay79 / BarsAppAmplify / App.js View on Github external
    jwtToken: async () => (await Auth.currentSession()).getIdToken().getJwtToken(),
  },