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

Undocumented Changes to provider fields #10857

Open
Nik-Novak opened this issue May 8, 2024 · 0 comments
Open

Undocumented Changes to provider fields #10857

Nik-Novak opened this issue May 8, 2024 · 0 comments
Labels
bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@Nik-Novak
Copy link

Provider type

Custom provider, Twitch

Environment

System:
    OS: Linux 5.15 Ubuntu 20.04.6 LTS (Focal Fossa)
    CPU: (16) x64 AMD Ryzen 9 5950X 16-Core Processor
    Memory: 3.04 GB / 15.75 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 20.12.0 - ~/.nvm/versions/node/v20.12.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.12.0/bin/yarn
    npm: 10.5.0 - ~/.nvm/versions/node/v20.12.0/bin/npm
  npmPackages:
    @auth/prisma-adapter: ^1.5.1 => 1.5.1 
    next: ^14.2.3 => 14.2.3 
    next-auth: ^5.0.0-beta.17 => 5.0.0-beta.17 
    react: ^18.3.1 => 18.3.1

Reproduction URL

https://github.com/Nik-Novak/Mind-Knight

Describe the issue

  • In V4 you could provide a custom function to 'token' and 'userinfo' fields:
token: {
      async request() {
        console.log('RUN token');
        if (!req.url) {
          throw new Error('No URL found in request object')
        }

        const identifier = await verifyAssertion(req, realm, returnTo)

        if (!identifier) {
          throw new Error('Unauthenticated')
        }

        return {
          tokens: new TokenSet({
            id_token: randomUUID(),
            access_token: randomUUID(),
            steamId: identifier
          })
        }
      }
    },
    
    userinfo: {
      async request(ctx) {
        console.log('RUN userinfo.request');
        const url = new URL('https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002')

        url.searchParams.set('key', ctx.provider.clientSecret as string)
        url.searchParams.set('steamids', ctx.tokens.steamId as string)

        const response = await fetch(url)
        const data = await response.json()
        console.log('PROFILE',data.response.players[0] );
        return data.response.players[0]
      }
    },

In V5, this no longer works and causes all kinds of errors. Can this be resolved or can we get some documentation on the changes?

How to reproduce

Try to migrate this to V5: https://pastebin.com/rDH6GZ1a

(was working fine in V4)

Expected behavior

.

@Nik-Novak Nik-Novak added bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

1 participant