feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
14.97k stars 744 forks source link

Getting started guide has small part of code missing, leaving final login with Github broken #3258

Open IcyFoxe opened 11 months ago

IcyFoxe commented 11 months ago

Steps to reproduce

Follow the getting started guide by copying all parts of the code as specified.

Expected behavior

At the end of the guide, user should be able to login, either through email or Github authorization and use the chat app.

Actual behavior

After Github authorization, user is stuck at the login screen instead, and pressing the Login with Github button again will refresh the page and throw this error message in the server log:

image

Final note

When comparing to the finished project repo, I found this difference in the code from the getting started guide and the finished project repo in the authentication.ts file:

image

Turns out that the code from the guide was missing the || profile.login part. After adding it, everything started to work fine.

(also the finished Feathers Chat repo is a bit outdated, it's throwing some warnings when packages are installed)

ioev commented 8 months ago

Also on this page: https://feathersjs.com/guides/basics/login.html

The lines:

import { oauth, OAuthStrategy } from '@feathersjs/authentication-oauth'
...
app.configure(oauth())

are not highlighted.

Though even with that change, I get:

error: TypeError: Cannot read properties of undefined (reading 'sub')
    at GitHubStrategy.getEntityQuery (/home/jperry/Workspace/feathers-chat/node_modules/@feathersjs/authentication-oauth/src/strategy.ts:40:35)
    at GitHubStrategy.findEntity (/home/jperry/Workspace/feathers-chat/node_modules/@feathersjs/authentication-oauth/src/strategy.ts:109:30)
    at GitHubStrategy.authenticate (/home/jperry/Workspace/feathers-chat/node_modules/@feathersjs/authentication-oauth/src/strategy.ts:163:40)