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

feat(providers): Add Riot Games RSO Provider #10826

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

ArkShocer
Copy link
Contributor

@ArkShocer ArkShocer commented May 5, 2024

☕️ Reasoning

Adding Riot Games RSO Provider. Tested it with the current stable next-auth version 4.24.7 on nextjs 14.2.3

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

📌 Resources

Copy link

vercel bot commented May 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ❌ Failed (Inspect) May 15, 2024 1:00pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview May 15, 2024 1:00pm

Copy link

vercel bot commented May 5, 2024

@ArkShocer is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

public domain to test it or create a proxy in your environment.
</Callout>

### Signed-JWT Method
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this section, maybe we just take that callout warning out of the callout, i.e. just put that as regular text under this heading. And then remove the superfluous example at the bottom. It's not adding anything new that the above examples aren't, right?

Also it uses the pages router path and doesn't use the env var inference, so it could be confusing to new users

*
* :::
*/
export default function RSO<P extends RSOProfile>(
Copy link
Member

@ndom91 ndom91 May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this seems to be an openid-connect compatible provider, this can be significantly simplified. Can you give this version a shot and let me know if it still works for you?

Also, please double check the profile return values. We need them to be id, name, email, image. Since that's what all next-auth users will have in their database via the default schemas, for example. We can't just return any fields we want here (by default). Maybe adding some additional scopes (like account or profile) will include the required fields in the id_token response? (see for example: https://gist.github.com/Henrik-3/d6b631fb7c61821bc16b17cd347a3811#sending-users-to-your-rso-page)

export default function RSO<P extends RSOProfile>(
  options: OAuthUserConfig<P>
): OAuthConfig<P> {
  return {
    id: "rso",
    name: "Riot Sign On",
    type: "oidc",
    issuer: "https://auth.riotgames.com",
    authorization: {
      params: {
        scope: "openid offline_access access_tokens cpid",
      },
    },
    profile(profile) {
      return {
        id: profile.sub,
        name: profile.sub,
        email: profile.cpid,
        image: profile.jiti,
      }
    },
    style: {
      brandColor: "#f05b5e"
    },
    options
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Refers to `@auth/core` providers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants