Replies: 1 comment 1 reply
-
Thank you for this! I've been thinking about adding some sort of option to Providers to support this (e.g. passing the Access Token to the callback or add the option to specify an additional profile details URL) as I think I ran into one other site where this can happen - although it's unusual. We might also want to consider passing the contents ID Token to the getProfile() function. cc @balazsorban44 in case that last comment is interesting / seems worth considering. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Since Linkedin doesn't expose the email address of an account in the profile request,
you must use a separate call to grab it.
I wanted to deeply understand the architecture and sequence flow of next-auth operations, to find ways
to hack wanted changes/enhancements without having to fork.
This is an example of populating users.email during sign in, so it is populated into the users record in the db.
The signIn callback is called before the users record is created for a new user.
Note that 'r_emailaddress' has been added to the oauth requested scope:
You can't do the fetch in the profile() handler of the Provider options as you are not provided the accessToken.
Note: also using a custom Email provider which simply queues the email to be processed by a separate worker instead of trying to send it immediately.
Queueing the email e.g. async, means faster return time to request, and it doesn't break the signin flow if there's an issue generating the email e.g. the upstream mail server is dead.
Beta Was this translation helpful? Give feedback.
All reactions