nextauthjs / next-auth

Authentication for the Web.
https://authjs.dev
ISC License
23.18k stars 3.17k forks source link

Reduce user facing provider APIs #1022

Closed balazsorban44 closed 3 years ago

balazsorban44 commented 3 years ago

Currently, there are some "magical" 🧙 fields only utilized by specific providers. We could handle these edge cases internally instead. All providers have an id, which we can use to switch on different behaviors. It would also make it easier to keep a TypeScript provider interface simple, without the need for Discriminated Union or similar

Some of these fields and which provider(s) use them (introduced in which PR):

balazsorban44 commented 3 years ago

@cathykc As the original author of #895, I would like to ask you, how strongly do you feel about additionalAuthorizeParams being a provider property, instead of using the (new) third argument of the signIn client function?

https://github.com/nextauthjs/next-auth/blob/f2ad69358fb6e650035c85d320440468d0286377/src/client/index.js#L226-L242

Example:

<button
  onClick={() => signIn("slack", {}, {user_scope: 'identity.basic,identity.email,identity.avatar'})}
>
  Login
</button>

Right now, there are 2 ways of doing it, and we could eventually keep both, I was just curious about your opinion. Setting authorize params may actually be useful for several providers and can be a general thing in contrast to the other, above mentioned magical provider properties, so I may even be OK with removing the authParams from the client signIn function instead. I might want to rename it to just authParams or authorizeParams removing the additional prefix.

UPDATE: After giving it some thought, I think it makes more sense to keep your change and remove it from the signIn client-side function.

balazsorban44 commented 3 years ago

@cathykc when #1023 will be merged, the name will change from

additionalAuthorizeParams to authorizationParams. This plays better with the already present authorizationUrl.

I changed the slack provider respectively, so no changes will be needed.

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 3.2.0-canary.15 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 3.3.0-canary.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket: