Closed hallowatcher closed 5 months ago
If you need an example, I made a full custom implementation of an OAuth strategy for osu!
.
In the method for returning a profile from the API, I want to return the full API user instead of the one that extends OAuth2Profile, which like mentioned has properties that I will never need.
So in this example, I just want to write return await request.json()
instead of creating a new object.
From the OAuth2Profile the only required field is the provider
, the rest are optional meaning you can add only what you need. But if you need something that the OAuth2Profile uses it would be ideal to return it, for example use displayName for the username.
The reason the OAuth2Profile exists is to allow strategy authors to normalize the data, if you install any OAuth2-based strategy you know the profile has an array of emails for example.
But if you're extending the OAuth2Strategy locally in your project feel free to return anything you need.
Hey, I had a question about OAuth2 profiles. Currently in this library, they are typed like this:
This means that any type of profile I pass in must extend from that OAuth2Profile interface, even if it doesn't include all of those properties.
How can I type this to only be what the OAuth API provides?