Skip to content

Android - Implement support for space separated scopes #134

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

Merged
merged 1 commit into from
Aug 7, 2017

Conversation

mribbons
Copy link
Contributor

I had an issue with http://github.com/identityServer/IdentityServer3 where it expects a space separated list of scopes, while react-native-oauth supports a comma separated list.

In the previous code, spaces are removed before the string is split by comma.

To use the option:

    manager.addProvider({
        'our_provider': {
            auth_version: '2.0',
            authorize_url: 'http://example.com/authorize',
            access_token_url: 'http://example.com/token',
            access_token_verb: 'post',
            api_url: 'http://example.com/api',
            callback_url: ({app_name}) => `${app_name}://oauth`
        }
    });

    manager.configure({
      our_provider: {
        client_id: 'sample',
        client_secret: 'secret',
        consumer_key: 'must_be_provided_for_custom_provider',
        api_key: 'must_be_provided_for_custom_provider',
        consumer_secret: 'must_be_provided_for_custom_provider',
        rawScopes: 'true'
      }
    });

    manager.authorize('our_provider', {scopes: 'openid profile api1'});

This resolves the issue.

Note that I have not tested with ios.

Note that this PR is similar to a0dd695, except that it is a non breaking change.

Implement rawScopes configuration option - Handle auth servers that
expect space separated list of scopes.

Without the option enabled spaces are removed from scope string.
@auser auser merged commit 2a1fb1b into fullstackreact:master Aug 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants