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

V2.0: oAuth (with future proofing) #176

Open
thatkookooguy opened this issue Nov 3, 2018 · 3 comments
Open

V2.0: oAuth (with future proofing) #176

thatkookooguy opened this issue Nov 3, 2018 · 3 comments
Assignees
Labels
feature Everything that needs an implementation and is new Server Related to server side changes

Comments

@thatkookooguy
Copy link
Member

thatkookooguy commented Nov 3, 2018

oAuth (with future proofing)

FEATURE

We want to implement oAuth in version 2.0 of achievibit.

Basically, this is the functionality we want:

  • User can login with GitHub | GitLab | BitBucket using nest+passport

    we can use passport strategies for GitHub, GitLab, & BitBucket
    more strategies can be found here

  • User is stored to a separate table that holds authenticated users (which is different than users who got achievements but never logged in)
  • User can login with multiple services at the same time. Identifier should be the email address which is unique (at least the primary AFAIK)

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@thatkookooguy
Copy link
Member Author

We need the same permissions as used by Travis CI

This is basically it: https://docs.travis-ci.com/user/github-oauth-scopes/

Since we want something very similar: posting status on pull requests, and adding webhook

and this should also handle the token authentication header for all requests for specific user data with an @AuthGuard guard and pipe

@thatkookooguy
Copy link
Member Author

issue #55 can be seen for references on older version

@thatkookooguy thatkookooguy added feature Everything that needs an implementation and is new Server Related to server side changes labels Nov 3, 2018
@thatkookooguy thatkookooguy added this to the achievibit V2.0 milestone Nov 3, 2018
@thatkookooguy
Copy link
Member Author

thatkookooguy commented Nov 5, 2018

Some material:

Some specific info:

We need a new table in our DB to handle authenticated users (which is not the same as regular users). This will include a method attribute which will be an array of attached methods (github, gitlab, or bitbucket) where the first one is the default one (or a string?). Besides that, each authUser will also contain the provider data:

import { Schema } from 'mongoose';

export const UserSchema: Schema = new Schema({
  method: {
    type: String,
    enum: ['github', 'gitlab', 'bitbucket'],
    required: true
  },
  roles: [String],
  github: {
    id: String,
    email: String,
    displayName: String,
    // ...
  },
  gitlab: {
    id: String,
    email: String,
    // ...
  },
  bitbucket: {
    id: String,
    username: String,
    displayName: String,
    // ...
  }
});

And we need to read the attached data to understand where to put the token from the oauth provider. achievibit actually needs that token for fetching extra PR data (which should happen with the user's access token)

@dunaevsky dunaevsky self-assigned this Nov 5, 2018
@ZimGil ZimGil assigned ZimGil and unassigned dunaevsky Mar 14, 2020
ZimGil added a commit that referenced this issue Mar 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Everything that needs an implementation and is new Server Related to server side changes
Projects
None yet
Development

No branches or pull requests

3 participants