Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement linkedin login #131

Merged

Conversation

dsmabulage
Copy link
Contributor

Purpose

The purpose of this PR is to fix #57

Goals

  • Implement LinkedIn login strategy using Passport.js.
  • Create a generic function for creating user profiles based on authentication provider data.
  • Refactor existing Passport strategies to support multiple authentication providers seamlessly.
  • Update environment variables to securely store API keys and secrets.
  • Rename Passport strategy files to maintain consistency and clarity (e.g., google.strategy.ts to google-passport.ts).

Approach

  • Implement LinkedIn Login:

    • Introduce a new LinkedIn authentication strategy (linkedin-passport.ts) using Passport.js.
    • Configure LinkedIn API keys and secrets in environment variables (LINKEDIN_CLIENT_ID, LINKEDIN_CLIENT_SECRET, LINKEDIN_REDIRECT_URL).
    • Handle LinkedIn profile data retrieval and user creation using a generic function (createProfile) for consistency across providers.
  • Create Generic Function for Create Profile:

    • Define createProfile function to extract and format user profile data from different authentication providers (e.g., LinkedIn, Google).
    • Ensure createProfile handles variations in profile structure and maps fields appropriately to CreateProfile interface.
  • Refactor Passport Strategies:

    • Refactor existing Passport strategies (google-passport.ts, linkedin-passport.ts) to follow a unified structure.
    • Abstract common functionality into helper functions or middleware for better code maintainability and readability.
  • Update Environment Variables:

    • Add or update environment variables (LINKEDIN_CLIENT_ID, LINKEDIN_CLIENT_SECRET, LINKEDIN_REDIRECT_URL) in .env file.
    • Ensure environment variables are securely managed and accessed within the application.
  • Rename Passport Strategy Files:

    • Rename existing Passport strategy files to reflect the authentication provider they support.
    • Maintain consistent naming conventions across all Passport strategy files for clarity and organization.

Screenshots

Checklist

  • This PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.
  • I have read and understood the development best practices guidelines ( http://bit.ly/sef-best-practices )
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation

Related PRs

Test environment

Learning

src/configs/linkedin-passport.ts Outdated Show resolved Hide resolved
Copy link
Member

@anjula-sack anjula-sack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! @dsmabulage

@anjula-sack anjula-sack merged commit b6ff45c into sef-global:main Jul 14, 2024
1 check passed
@dsmabulage dsmabulage deleted the bugfix/issue-57_linkedin-login branch July 14, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement linkedin authentication with Passport js
3 participants