Git Product home page Git Product logo

Comments (3)

simov avatar simov commented on April 27, 2024

The plugin generates a session called grant when it redirects to the facebook pr twitter login, and not when you logged in successfully.

Can you clarify that? I'm not sure I understand your issue correctly.

from grant.

jgauna avatar jgauna commented on April 27, 2024

As I understand you're using Yar to create a session. This session is created when the route redirects to Facebook or Twitter login page. If my assumption is correct, it's an error because the session should be created when you are logged in and not before. If it's not, how do I get the session in the route handler?

from grant.

simov avatar simov commented on April 27, 2024

The grant key in your user's session is created once you initiate a flow through the /connect/[provider] route.

You can get the contents of this key using:

req.session.get('grant')

There you have a bunch of other keys used internally by grant:

{
  // the provider currently being authorized with
  provider: 'facebook',
  // in case you passed dynamic configuration
  dynamic: {},
  // this holds the data returned by the third party server after the authorization step
  step1: {},
  // in case you pass `session: true` in your server config,
  // you'll receive the results from the OAuth flow here
  response: {}
}

The dynamic and the step1 keys are used internally by Grant. You should handle the contents of the response key somehow, and provider is just letting you know which provider is this.

Next time you authenticate with some other provider (or the same) all of the keys in the grant session object will be overridden.

In case you want to clean up the grant object from your session after the OAuth flow is complete, you can:

req.session.set('grant', undefined)

In your final callback.

Let me know if that helps.

from grant.

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.