Group Group Group Group Group Group Group Group Group

Chapter 23 Github Authentication

Hey folks,

I implemented the google login fine and when I was implementing the Github login, the first time I tried to login with Github I was sent to the Github login screen, entered my creds and was sent to the authorization page, clicked the button to authorize the TIL app and was thrown an error there.

I logged out and logged in with google again, and was logged in correctly. Then I logged out of the TIL app and tried to login with Github again. I was immediately thrown an error and the url was http://localhost:8080/oauth/github?code=07130fd5465dfbcfec22
Is this possible a token issue or session issue? The second login with google brings me right into the home screen, but subsequent attempts to login with Github seems to throw errors immediately.

I’m using the Chrome browser in incognito mode because safari seems to force connections to localhost through https for some reason.

The TIL Server app seems to also be throwing multiple errors after the GitHub login attempts

**Server starting on http://localhost:8080**

**[ ERROR ] Abort.404: Not Found (ApplicationResponder.swift:50)**

**2019-04-11 15:59:19.362871-0700 Run[10022:141943] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=10022**

**2019-04-11 15:59:19.362960-0700 Run[10022:141943] SecTaskCopyDebugDescription: Run[10022]/0#-1 LF=0**

**[ ERROR ] Abort.404: Not Found (ApplicationResponder.swift:50)**

**[ ERROR ] Abort.404: Not Found (ApplicationResponder.swift:50)**

**2019-04-11 16:01:20.220707-0700 Run[10022:143790] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x101d24090] get output frames failed, state 8196**

**2019-04-11 16:01:20.220745-0700 Run[10022:143790] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C1.1:2][0x101d24090] get output frames failed, state 8196**

**2019-04-11 16:01:20.220880-0700 Run[10022:143790] TIC Read Status [1:0x0]: 1:57**

**2019-04-11 16:01:20.220889-0700 Run[10022:143790] TIC Read Status [1:0x0]: 1:57**

**2019-04-11 16:01:42.432617-0700 Run[10022:144091] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C2.1:2][0x104d2ec80] get output frames failed, state 8196**

**2019-04-11 16:01:42.432655-0700 Run[10022:144091] [BoringSSL] nw_protocol_boringssl_get_output_frames(1301) [C2.1:2][0x104d2ec80] get output frames failed, state 8196**

**2019-04-11 16:01:42.432784-0700 Run[10022:144091] TIC Read Status [2:0x0]: 1:57**

**2019-04-11 16:01:42.432793-0700 Run[10022:144091] TIC Read Status [2:0x0]: 1:57**

the actual error seems to be

**[ ERROR ] DecodingError.valueNotFound: Value of type 'String' required for key 'name'. (ErrorMiddleware.swift:26)**

Is the response from Github not in the manner we are expecting here? or do I need to do some update on Imperial? Where can I check what response to expect from the GitHub api?

It’s possible it’s a bug in Imperial because you’re already logged in, I’ll take a look. But definitely make sure you’re on the latest versions of everything with swift package update

Have you had any luck figuring this one out?

I am getting the same error.

And that’s starting with:
• swift package update
• final version of the source files in 23-github-authentication
• adding Google and GitHub environment variables in Xcode

When I click on the Github button…

Safari (v12.1.2) displays:

{"error":true,"reason":"Value of type 'String' required for key 'name'."}

Xcode (v10.3) logs:

[ ERROR ] Abort.404: Not Found (ApplicationResponder.swift:50)

2019-09-07 11:53:43.179453-0400 Run[71258:3233308] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=71258

2019-09-07 11:53:43.179547-0400 Run[71258:3233308] SecTaskCopyDebugDescription: Run[71258]/0#-1 LF=0

[ ERROR ] DecodingError.valueNotFound: Value of type 'String' required for key 'name'. (ErrorMiddleware.swift:26)

[ ERROR ] Abort.404: Not Found (ApplicationResponder.swift:50)

When I click on the Google button…

Safari (v12.1.2) displays:

{"error":true,"reason":"null value in column \"email\" violates not-null constraint"}

Xcode (v10.3) displays:

[ ERROR ] Abort.404: Not Found (ApplicationResponder.swift:50)

2019-09-07 13:24:17.347930-0400 Run[84359:3429739] SecTaskLoadEntitlements failed error=22 cs_flags=20, pid=84359

2019-09-07 13:24:17.348022-0400 Run[84359:3429739] SecTaskCopyDebugDescription: Run[84359]/0#-1 LF=0

[ ERROR ] PostgreSQLError.server.error.ExecConstraints: null value in column "email" violates not-null constraint (ErrorMiddleware.swift:26)

[ DEBUG ] Possible causes for PostgreSQLError.server.error.ExecConstraints: Failing row contains (efb3612c-7f91-406c-9623-4caf20d098f0, B G, yousnite@gmail.com, 33C08F20-BFFD-4CCD-A89E-FA0D4BAAC095, null, null, null, null). (ErrorMiddleware.swift:26)

[ ERROR ] Abort.404: Not Found (ApplicationResponder.swift:50)

Hmm that would suggest that the POST request you’re sending (or Google/GH is sending) doesn’t match up with what the code is expecting. Do you know what line of code it’s failing on?

i got the same error when follow vapor book raywenderlich(server side swift with vapor) at chapter 2: hello world. After type “vapor run” in terminal as instruction, i got <[ ERROR ] Abort.404: Not Found (ApplicationResponder.swift:50)> so how can i iron it out, please help me, thank you!

@vudat81299 what request gives you that error or is it in the browser? If it’s in the browser and everything else works you can just ignore it, it’s the browser asking for a favicon, which doesn’t exist in the app