Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
224 views
in Technique[技术] by (71.8m points)

javascript - Auth Library for social logins

I'm trying to add identity verification to my web-app.

Ideal flow is that a protected page can only be accessed by people having certain email addresses. They can prove their identity using any social login(Google, LinkedIn etc.)

I only need to get user's email address from these platforms. Instead of building it on my own for each provider, I'm looking for a npm package or similar that does this.

I came across auth0, but

  1. They aren't free
  2. I don't need a 3rd party server side which creates users in their database. In fact, I wouldn't be creating users at all with this flow, it's only for identity verification.

I'm happy to generate my own client id and secrets for each platform and plug them in in a config file.

It's also not a requirement for me to show my branding for the verification, I'm happy to use 3rd party name coming on auth screen(As long as they're well known).

It is a requirement though, to keep the oauth scopes to be restricted to only read user's profile info and nothing else.

What are my options?

question from:https://stackoverflow.com/questions/66057467/auth-library-for-social-logins

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Unlike the solutions above, it does not list a library for all social logins.

But, the simple answer is passport.

Edit: Links below don't work, use https://www.passportjs.org

https://passportjs.org/ https://passportjs.org/packages/

Supports discord, google, twitter, facebook, and 500+ more

Search for it http://www.passportjs.org/packages/

If this solves your solution, please accept my answer. Thanks :)

(If this does not help you, just leave a comment and I'll fix it)

EDIT: npm install passport

document.getElementById('bye').onclick = function(){
location.replace("google.com/search?q=" + document.getElementById("bye").value)
}
<input id='hi' placeholder="Goole search">
<button id='bye'>Submit</button>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...