cmd-johnson / deno-oauth2-client

Minimalistic OAuth 2.0 client for Deno.
MIT License
45 stars 9 forks source link

Examples broken - the JSON entry 'name' changed to 'login' #18

Closed psytrap closed 2 years ago

psytrap commented 2 years ago

The JSON entry 'name' has changed to 'login'. This breaks the examples and nothing is shown in the login page. After changing it to 'login' the GitHub user name is shown.

https://github.com/cmd-johnson/deno-oauth2-client/blame/master/README.md#L54

https://github.com/cmd-johnson/deno-oauth2-client/blame/master/examples/oak.ts#L31

https://github.com/cmd-johnson/deno-oauth2-client/blob/master/examples/http.ts#L49

Here a working example for deno.dev hosting: https://dash.deno.com/projects/dry-pigeon-88

cmd-johnson commented 2 years ago

Thanks for filing this issue!

I wasn't able to reproduce this on my end, however. After setting my own client ID and secret, the example works just fine for me. The documentation of the https://api.github.com/user endpoint includes both the login and name fields, so I don't see a reason there, why it wouldn't work.

Can you show me the exact code that didn't work for you?

psytrap commented 2 years ago

I think I found the root cause. My name is not set on my "Public Profile" settings for github. To be correct the result for name is then "null" on my profile. In your GitHub profile I see "Jonas Auer" as name and I guess "cmd-johnson" is your login id.

cmd-johnson commented 2 years ago

Huh, you're right, the name field in GitHub's response is nullable:

"name": {
  "type": [
    "string",
    "null"
  ],
  "examples": [
    "monalisa octocat"
  ]
},

To keep the examples simple, I'll update them to use the title as you suggested, as that should work every time! :+1: