a3.14_Infinity
a3.14_Infinity

Reputation: 5851

react native app auth - How to make scopes as optional?

I am trying to implement OAuth into my react native app. I am using react native app auth.

I would like to make scope as optional.

Currently, it is mandatory. How do I do that?

Can I modify the code of react native app auth and build it and import into my Example code?

Upvotes: 1

Views: 539

Answers (1)

jevakallio
jevakallio

Reputation: 35960

One of the maintainers of react-native-app-auth here.

Up until this moment I was under the impression that the scope parameter was a required paramater in the OAuth 2.0 request spec, but looking at the relevant spec definition, it appears to be optional.

You should be able to remove the array.length check in the validateScopes helper. You can try this by editing the index.js file in your app's node_modules/react-native-app-auth/ directory.

Once done, you can pass an empty array [] as scopes. I'm not sure how the underlying AppAuth native libraries deal with it, but if it works, you can open a PR to react-native-app-auth and I'm happy to accept the change.

Upvotes: 1

Related Questions