snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
This commit is contained in:
20
apps/meteor/packages/linkedin-oauth/LICENSE
Normal file
20
apps/meteor/packages/linkedin-oauth/LICENSE
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
22
apps/meteor/packages/linkedin-oauth/README.md
Normal file
22
apps/meteor/packages/linkedin-oauth/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
accounts-linkedin
|
||||
============================
|
||||
|
||||
A meteor package for LinkedIn's OAuth flow.
|
||||
|
||||
### Important
|
||||
BREAKING CHANGE LinkedIn -> Linkedin inside code
|
||||
|
||||
from v4.0.0 works with Meteor@1.6.1 & up
|
||||
|
||||
From March 1, 2019 Linkedin will be using only V2 API [Docs](https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/migration-faq?context=linkedin/consumer/context)
|
||||
|
||||
Install
|
||||
-----------
|
||||
```
|
||||
meteor add pauli:linkedin-oauth
|
||||
```
|
||||
|
||||
|
||||
License
|
||||
-----------
|
||||
[MIT](https://github.com/PauliBuccini/meteor-accounts-linkedin/blob/master/LICENSE)
|
||||
11
apps/meteor/packages/linkedin-oauth/linkedin-client.js
Normal file
11
apps/meteor/packages/linkedin-oauth/linkedin-client.js
Normal file
@@ -0,0 +1,11 @@
|
||||
export const Linkedin = {};
|
||||
|
||||
// Request LinkedIn credentials for the user
|
||||
// @param options {optional}
|
||||
// @param credentialRequestCompleteCallback {Function} Callback function to call on
|
||||
// completion. Takes one argument, credentialToken on success, or Error on
|
||||
// error.
|
||||
Linkedin.requestCredential = async function (options, credentialRequestCompleteCallback) {
|
||||
// This function will be replaced by meteorOverrides/login/linkedin.ts
|
||||
throw new Error('Linkedin integration error - invalid reference to original requestCredential implementation.');
|
||||
};
|
||||
117
apps/meteor/packages/linkedin-oauth/linkedin-server.js
Normal file
117
apps/meteor/packages/linkedin-oauth/linkedin-server.js
Normal file
@@ -0,0 +1,117 @@
|
||||
import { Accounts } from 'meteor/accounts-base';
|
||||
import { fetch } from 'meteor/fetch';
|
||||
import { OAuth } from 'meteor/oauth';
|
||||
import { ServiceConfiguration } from 'meteor/service-configuration';
|
||||
|
||||
export const Linkedin = {};
|
||||
|
||||
// returns an object containing:
|
||||
// - accessToken
|
||||
// - expiresIn: lifetime of token in seconds
|
||||
const getTokenResponse = async function (query) {
|
||||
const config = await ServiceConfiguration.configurations.findOneAsync({ service: 'linkedin' });
|
||||
if (!config) throw new Accounts.ConfigError('Service not configured');
|
||||
|
||||
let responseContent;
|
||||
try {
|
||||
// Request an access token
|
||||
const body = new URLSearchParams({
|
||||
grant_type: 'authorization_code',
|
||||
client_id: config.clientId,
|
||||
client_secret: OAuth.openSecret(config.secret),
|
||||
code: query.code,
|
||||
redirect_uri: OAuth._redirectUri('linkedin', config),
|
||||
});
|
||||
|
||||
const response = await fetch('https://api.linkedin.com/uas/oauth2/accessToken', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
body,
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(responseContent.error_description);
|
||||
}
|
||||
|
||||
responseContent = await response.json();
|
||||
} catch (err) {
|
||||
throw new Error(`Failed to complete OAuth handshake with Linkedin. ${err.message}`);
|
||||
}
|
||||
|
||||
// Success! Extract access token and expiration
|
||||
const accessToken = responseContent.access_token;
|
||||
const expiresIn = responseContent.expires_in;
|
||||
|
||||
if (!accessToken) {
|
||||
throw new Error(
|
||||
`Failed to complete OAuth handshake with Linkedin -- can't find access token in HTTP response. ${JSON.stringify(responseContent)}`,
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
accessToken,
|
||||
expiresIn,
|
||||
};
|
||||
};
|
||||
|
||||
// Request available fields from profile
|
||||
const getIdentity = async function (accessToken) {
|
||||
try {
|
||||
const url = encodeURI(`https://api.linkedin.com/v2/userinfo`);
|
||||
const request = await fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
},
|
||||
});
|
||||
|
||||
if (!request.ok) {
|
||||
throw new Error(await request.text());
|
||||
}
|
||||
|
||||
return request.json();
|
||||
} catch (err) {
|
||||
throw new Error(`Failed to fetch identity from Linkedin. ${err.message}`);
|
||||
}
|
||||
};
|
||||
|
||||
OAuth.registerService('linkedin', 2, null, async (query) => {
|
||||
const response = await getTokenResponse(query);
|
||||
const { accessToken } = response;
|
||||
const identity = await getIdentity(accessToken);
|
||||
|
||||
const { sub, given_name, family_name, picture, email } = identity;
|
||||
|
||||
if (!sub) {
|
||||
throw new Error('Linkedin did not provide an id');
|
||||
}
|
||||
|
||||
const fields = {
|
||||
linkedinId: sub,
|
||||
firstName: given_name,
|
||||
lastName: family_name,
|
||||
profilePicture: picture,
|
||||
emailAddress: email,
|
||||
email,
|
||||
};
|
||||
|
||||
const serviceData = {
|
||||
id: sub,
|
||||
accessToken,
|
||||
expiresAt: +new Date() + 1000 * response.expiresIn,
|
||||
...fields,
|
||||
};
|
||||
|
||||
return {
|
||||
serviceData,
|
||||
options: {
|
||||
profile: fields,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
Linkedin.retrieveCredential = function (credentialToken, credentialSecret) {
|
||||
return OAuth.retrieveCredential(credentialToken, credentialSecret);
|
||||
};
|
||||
19
apps/meteor/packages/linkedin-oauth/package.js
Normal file
19
apps/meteor/packages/linkedin-oauth/package.js
Normal file
@@ -0,0 +1,19 @@
|
||||
Package.describe({
|
||||
name: 'pauli:linkedin-oauth',
|
||||
version: '6.0.0',
|
||||
summary: 'LinkedIn OAuth flow, use with Meteor 1.6.1 & up',
|
||||
git: 'https://github.com/PoBuchi/pauli-linkedin-oauth',
|
||||
documentation: 'README.md',
|
||||
});
|
||||
|
||||
Package.onUse((api) => {
|
||||
api.use('ecmascript');
|
||||
api.use('oauth2', ['client', 'server']);
|
||||
api.use('oauth', ['client', 'server']);
|
||||
api.use('fetch', ['server']);
|
||||
api.use('random', 'client');
|
||||
api.use('service-configuration', ['client', 'server']);
|
||||
|
||||
api.mainModule('linkedin-client.js', 'client');
|
||||
api.mainModule('linkedin-server.js', 'server');
|
||||
});
|
||||
Reference in New Issue
Block a user