rurumimic / react-ts

React.js + Koa.js with TypeScript
8 stars 2 forks source link

Not an issue, a thank you #5

Closed Jean-Baptiste-Lasselle closed 3 years ago

Jean-Baptiste-Lasselle commented 3 years ago

Hi, I wanted to thank you :

I found one example in your repository, and wanted to thank you about it :)

One question though : I could ot find the source code of the Profile type, which I suppose is an interface, have I missed it ?

Oh yeah, just found it import { Profile } from 'passport-github2'

Note that you have a small issue :

rurumimic commented 3 years ago

Hi

You're right.

Add Profile interface.

import { Strategy, Profile } from 'passport-github2'

The second argument of the done is object.

const verify = (
  accessToken: string,
  refreshToken: string,
  profile: Profile,
  done: OAuth2Strategy.VerifyCallback
): void => {
  console.log('accessToken', accessToken)
  console.log('refreshToken', refreshToken)
  console.log('profile', profile)
  return done(null, { id: profile.id, key1: profile.displayName, key2: profile.profileUrl })
}

Thanks