Coder Social home page Coder Social logo

Comments (4)

mattcam avatar mattcam commented on May 4, 2024 2

Thanks. Turns out that the refreshToken is the Twitter accessTokenSecret.

from next-auth.

iaincollins avatar iaincollins commented on May 4, 2024 1

Thanks for leaving a comment for others!

This inconsistency between oAuth APIs (because the standard isn't explicit) is such a huge pain and endless confusion (and almost impossible to remember and track over time).

I might document the different names for properties in popular services in a table in the README (e.g. client/secret/key/access token/etc) so it's clearer.

from next-auth.

iaincollins avatar iaincollins commented on May 4, 2024

Hi there, yes (I think; I have not checked but it should work…).

The second parameter passed to the insert()function in next-auth.functions.js returns the full, raw profile object as returned by whatever oAuth service you are using - so if it is returned by the service you should be able to see it there.

insert: (user, oAuthProfile) => {
  return new Promise((resolve, reject) => {
    usersCollection.insert(user, (err, response) => {
      if (err) return reject(err)

      // Mongo Client automatically adds an id to an inserted object, but 
      // if using a work-a-like we may need to add it from the response.
      if (!user._id && response._id) user._id = response._id

      return resolve(user)
    })
  })
}

from next-auth.

iaincollins avatar iaincollins commented on May 4, 2024

Note: The insert() method is called only on account creation, I don't think the update() method also gets the raw profile from the oAuth provider as an option.

It's like this because APIs like Google normally only provide things like Refresh Tokens and other things you might want to capture on first login, but if if you have users with accounts already and want to capture them with update() I'm happy to add oAuthProfile as an additional parameter to update() too.

(This is a useful enquiry for the next update, thank you.)

from next-auth.

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.