Socket
Socket
Sign inDemoInstall

graph-interface-desktop-provider

Package Overview
Dependencies
70
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.2 to 0.1.3

34

index.js

@@ -12,2 +12,6 @@ const fs = require('fs');

return async function (credentials) {
const clientId = credentials.clientId || credentials.client_id || credentials['client-id'];
const clientSecret = credentials.clientSecret || credentials.client_secret || credentials['client-secret'];
const tenantId = credentials.tenantId || credentials.tenant_id || credentials['tenant-id'];
const refreshToken = createSecureJsonInterface(

@@ -20,7 +24,6 @@ `${options.refreshTokenPath}/refresh_token-${JSON.stringify(credentials)}`,

if (refreshToken.exists()) {
const {
refresh_token
} = refreshToken.load();
const { refresh_token } = refreshToken.load();
const getOptions = {
url: `https://login.microsoftonline.com/${credentials.tenantId}/oauth2/v2.0/token`,
url: `https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token`,
method: 'POST',

@@ -31,6 +34,6 @@ headers: {

form: {
client_id: credentials.clientId,
client_secret: credentials.clientSecret,
client_id: clientId,
client_secret: clientSecret,
grant_type: 'refresh_token',
redirect_uri: 'http://localhost:9090',
redirect_uri: 'http://localhost:' + options.port,
scope: 'https://graph.microsoft.com/.default offline_access',

@@ -41,6 +44,9 @@ refresh_token

const response = await get(getOptions);
refreshToken.save({
refresh_token: response.refresh_token
});
if(response.refresh_token) {
refreshToken.save({
refresh_token: response.refresh_token
});
}
return response;

@@ -67,6 +73,6 @@ }

const client = new Client({
clientId: credentials.clientId || credentials.client_id || credentials['client-id'],
clientSecret: credentials.clientSecret || credentials.client_secret || credentials['client-secret'],
authorizationUri: `https://login.microsoftonline.com/${credentials.tenantId || credentials.tenant_id || credentials['tenant-id']}/oauth2/v2.0/authorize`,
accessTokenUri: `https://login.microsoftonline.com/${credentials.tenantId || credentials.tenant_id || credentials['tenant-id']}/oauth2/v2.0/token`,
clientId,
clientSecret,
authorizationUri: `https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/authorize`,
accessTokenUri: `https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token`,
redirectUri: 'http://localhost:9090',

@@ -73,0 +79,0 @@ scopes: ['https://graph.microsoft.com/.default', 'offline_access']

{
"name": "graph-interface-desktop-provider",
"version": "0.1.2",
"version": "0.1.3",
"description": "Authentication Providers for delegated access on Graph-Interface",

@@ -5,0 +5,0 @@ "main": "index.js",

const options = {
refreshTokenPath: '.'
refreshTokenPath: '.',
port: 9090
};

@@ -4,0 +5,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc