Git Product home page Git Product logo

cognito-token's Introduction

Tokens with User Pools

This demo shows the real cognito three tokens in the aws document Using Tokens with User Pools. It also helps you to fully undertand how the payload looks like.

Preparation

  • create cognito user pool. You can reference the serverless stack in create_coginto_userpool
  • create at least one user in cognito user pool. If you want to create new user with command, reference signup.sh. You need login aws console to manually confirm this new user.
  • update username, password, user pool id and client id in config.json. There is a sample file for your reference: config.json.sample

Usage

run

$ npm install cognito-token
# edit config.json
$ cognito-token config.json

userData: {"Username":"bill","Pool":{"userPoolId":"....
===========================
Result methods: idToken,refreshToken,accessToken,clockDrift
idToken methods: jwtToken,payload
accessToken methods: jwtToken,payload
refreshToken methods: token
ID token payload's method: sub,email_verified,gender,iss,phone_number_verified,cognito:username,given_name,aud,event_id,token_use,auth_time,phone_number,exp,iat,family_name,email
user's mailbox: [email protected]
===========================
ID Token: eyJraWQiOiJoTxxxxVtZm1K5wZmIFA
===========================
Access token: eyJraWQiOixxxxy5H5LaCQTw
===========================
Refresh token: eyJjdHkiOixxxx8twwVe2CnDKMig

You should get three tokens: id token, access token and refresh token

I also added codes to show how to get these three token's methods and how to show the user's attributes, for example, his/her emailbox.

cognito-token's People

Contributors

ozbillwang avatar

Watchers

James Cloos avatar Aleksei Tcelishchev avatar

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.