sahat / satellizer

Token-based AngularJS Authentication
https://satellizer-sahat.rhcloud.com
MIT License
7.85k stars 1.13k forks source link

Custom parameters in `*UrlParams` #1124

Open vnwhlr opened 6 years ago

vnwhlr commented 6 years ago

Hello,

I have a use case for supplying non-standard query parameters to the authorization endpoint when calling authenticate(). In this case, it's supplying the team parameter when authorizing with Slack. We want users to associate their identity using a team ID that exists in our system, which is not a static value - it varies by user.

Looking at https://github.com/sahat/satellizer/blob/master/src/oauth2.ts#L132, though, it looks like this isn't possible, because in https://github.com/sahat/satellizer/blob/master/src/oauth2.ts#L139, either paramValue is a static value or the result of evaluating a function defined in the OAuth configuration, but there's nowhere in the authenticate signature where we can supply information accessible by that function.

Is there a workaround? Can I override the authorizationEndpoint or create a team function in the configuration to do something clever when building the query parameters? If there's no workaround, is this something that will eventually be supported? Slack can't be the only service that can take non-standard parameters in its OAuth flow (https://github.com/sahat/satellizer/issues/396).

Thanks!