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

Update Strava Provider #5241

Merged
merged 8 commits into from Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/versioned_docs/version-v3/providers/strava.md
Expand Up @@ -13,7 +13,7 @@ The **Strava Provider** comes with a set of default options:

- [Strava Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/strava.js)

You can override any of the options to suit your own use case.
You can override any of the options to suit your own use case. Ensure the `redirect_uri` configuration fits your needs accordingly.
Copy link
Member

Choose a reason for hiding this comment

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

@michaelangrivera my bad, but this was actually done in the wrong file! This is the v3 (unmaintained) documentation. Could you apply this change here in a follow-up PR: https://github.com/nextauthjs/next-auth/blob/main/docs/docs/providers/strava.md

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WIll do!

Copy link
Contributor Author

Choose a reason for hiding this comment

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


## Example

Expand All @@ -24,6 +24,11 @@ providers: [
Providers.Strava({
clientId: process.env.STRAVA_CLIENT_ID,
clientSecret: process.env.STRAVA_CLIENT_SECRET,
authorization: {
params: {
scope: process.env.STRAVA_SCOPES,
},
},
balazsorban44 marked this conversation as resolved.
Show resolved Hide resolved
})
]
...
Expand Down
@@ -1,5 +1,15 @@
/** @type {import(".").OAuthProvider} */
export default function Strava(options) {
import type { OAuthConfig, OAuthUserConfig } from "."

export interface StravaProfile extends Record<string, any> {
id: string // this is really a number
firstname: string
lastname: string
profile: string
}

export default function Strava<P extends StravaProfile>(
options: OAuthUserConfig<P>
): OAuthConfig<P> {
return {
id: "strava",
name: "Strava",
Expand All @@ -10,7 +20,6 @@ export default function Strava(options) {
scope: "read",
approval_prompt: "auto",
response_type: "code",
redirect_uri: "http://localhost:3000/api/auth/callback/strava",
},
},
token: {
Expand All @@ -20,11 +29,10 @@ export default function Strava(options) {
client: {
token_endpoint_auth_method: "client_secret_post",
},

profile(profile) {
return {
id: profile.id,
name: profile.firstname,
name: `${profile.firstname} ${profile.lastname}`,
email: null,
image: profile.profile,
}
Expand Down