Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
google-oauth-utility
Advanced tools
Readme
This is a module simplify the Google Oauth2 3 way handshack flow. Google's Oauth2 3 way handshack should participate with human, and we can use refresh token for extend the token's life. The module is use for transparent the refresh token exchange another token process. And user just need to do the first time to generate token file.
Using os path web application account.
gnutil -d [path-to-tmp-file]
The os path config file:
{
"CLIENT_ID":"429************kunu.apps.googleusercontent.com",
"CLIENT_SECRET":"yq***********0A",
"REDIRECT_URL":"http://localhost:8888/oauth2callback",
"DEFAULT_SCOPES": [
"https://www.googleapis.com/auth/userinfo.profile",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/plus.me"
]
}
In Mac or linux, you can put the config file under $HOME. In windows, please set the %HOME% for your system to let the module can find a path to store the file.
Using your own credential in command line:
gnutil -d [path-to-tmp-file] \
-c [your-client-id] \
-k [your-secret-key] \
-u [your-redirect-url] \
-s [your-scopes]
var oauth = require('google-oauth-utility');
var scopes = [ 'https://www.googleapis.com/auth/calendar',
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email'
];
var opts = {
clientId:'your-client-id',
clientSecret:'your-client-secret',
redirectUrl: 'your-redirect-url',
tmpPath:'/tmp/.gauth'
};
oauth.authflow(scopes, opts, function(err, tokens){
if(err) log.error(err);
console.log('process end..........');
console.log(tokens);
});
The function authflow will auto save the token to the tmpPath path. And if the path file exist, system will use the token file's refresh token to exchange token. The user side will no-need to join the token retrieve flow. If the tmpPath file not exist, user need join to do the Oauth2 auth flow.
FAQs
google-oauth-utility ====
The npm package google-oauth-utility receives a total of 0 weekly downloads. As such, google-oauth-utility popularity was classified as not popular.
We found that google-oauth-utility demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.