MaikuB / flutter_appauth

A Flutter wrapper for AppAuth iOS and Android SDKs
269 stars 238 forks source link

AuthorizationRequest feature: resource parameters or expand additionalParameters #488

Closed michelerenzullo closed 3 months ago

michelerenzullo commented 3 months ago

When using some providers (in my case LogTo), in order to get the "scoped token" for a specific resource we have to specify the latter in theAauthorizationRequest, therefore I add in additionalParameters: {'resource' : 'https://test.com/feedback'} but if I want to add also a second 'resource': 'https://example.com/child' I can't because is a Map additionalParameters, i.e. duplicate keys are not allowed, and there isn't any other params that I can use to carry on my resource ('audience')

the request should be like: ... &resource=https%3A%2F%2Ftest.com%2Ffeedback&resource=https%3A%2F%2Ftest.com%2Fchild

I would like to have a resource parameter that is a list of strings (like for scopes) rather than use additionalParameters(and I can just for 1 resource at time).

The behaviour is to do only an authorisation request for ALL resources<-->scopes and than using that code to get a token for 1 specific resource. This is the similar flow of logtoDartSdk.

MaikuB commented 3 months ago

Please look at submitting a PR for this

Note: I don't have capacity to check but wanted to call out that it's quite likely that the native SDKs being used are expecting dictionaries as well that what you're after may not be possible

michelerenzullo commented 3 months ago

Looks like logTo is non-standard, allowing multiple &resource=..., where Auth0 allow just 1 since is an HashMap. Do you see any viable way to add multiple times a parameter? I don't want to patch the whole Auth0. They use HashMap everywhere so is kinda difficult to don't go deep down in their code. Thanks anyway for you support

MaikuB commented 3 months ago

I don't have capacity to check as I mentioned earlier and you'd be better off checking this yourself. I should point out that this isn't an Auth0 library as it's a wrapper for AppAuth SDKs. As it's non-standard then you may need to consider a fork for your situation or you may even need to roll your own solution

michelerenzullo commented 3 months ago

Thanks, I will do. Closing issue