GithubHelp home page GithubHelp logo

Comments (7)

ottokruse avatar ottokruse commented on August 19, 2024

Hi @rpattcorner isn't this what you mean?

// Schedule check and refresh (when needed) of JWT's every 5 min:
const i = setInterval(() => Auth.currentSession(), 5 * 60 * 1000);

from cloudfront-authorization-at-edge.

rpattcorner avatar rpattcorner commented on August 19, 2024

Thanks, Otto ... it is. But I don't believe we're using the Amplify framework, which I think the example relies on, so I was searching for raw Cognito examples.

from cloudfront-authorization-at-edge.

ottokruse avatar ottokruse commented on August 19, 2024

Ah ok. But raw HTTP REST call to Cognito you mean? That would be a call to https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_InitiateAuth.html with AuthFlow set to "REFRESH_TOKEN_AUTH"

Amplify is gonna be way easier. Amplify is a big framework but you can just use the Auth portion of it.

from cloudfront-authorization-at-edge.

rpattcorner avatar rpattcorner commented on August 19, 2024

Nope, nothing that arcane. Just old-style calls using the javascript Cognito API that existed before Amplify. I think Amplify is a better idea too, but I'm out of developer resources so no resources for a new framework :(

from cloudfront-authorization-at-edge.

rpattcorner avatar rpattcorner commented on August 19, 2024

This sort of thing:

cognitoUser.refreshSession(refreshToken, (err, result)

from cloudfront-authorization-at-edge.

ottokruse avatar ottokruse commented on August 19, 2024

That should do it!

https://github.com/aws-amplify/amplify-js/blob/d308e6e510bd61102cc0a4a14198cd0d0d18cc5f/packages/amazon-cognito-identity-js/src/CognitoUser.js#L1436

from cloudfront-authorization-at-edge.

rpattcorner avatar rpattcorner commented on August 19, 2024

Many thanks We're using (and currently testing) an approach from this stack overflow that might do the trick.

However in doing so we have tried to speed the testing by using the new cognito feature to set token timeouts to something shorter than an hour. And we're seeing fails with auth@edge. That's a completely separate proposition and I'll open an issue for it.

from cloudfront-authorization-at-edge.

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.