Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Add additional scope for facebook #72

Merged
merged 2 commits into from
Apr 9, 2017

Conversation

pcofilada
Copy link
Contributor

@pcofilada pcofilada commented Apr 5, 2017

Add additional scope #71

  • user_friends
  • user_location
  • user_website

@adamjmcgrath
Copy link
Owner

adamjmcgrath commented Apr 8, 2017

Thanks for your PR, the scope change looks good, but I would prefer the fields to be customisable as well. In your PR, the default fields aren't available with the default scope.

You could pass custom fields on to the identity function the same way the Google provider passes the appId https://github.com/adamjmcgrath/react-native-simple-auth/blob/master/lib/providers/google.js#L53

eg. something like this (untested)

const FIELDS = [
  'id',
  'name',
  'first_name',
  'last_name',
  'verified',
  'email',
  'location',
  'link',
];

export const authorize = (
  { dance, request },
  { appId, callback, scope = SCOPE, fields = FIELDS },
) => pipeP(
  dance,
  replace('#', '?'),
  fromQueryString,
  set(lensProp('credentials'), __, {}),
  merge({ fields }),
)(authorizationUrl(AUTH, appId, callback, scope));

export const identify = curry((request, { credentials, fields }) => pipeP(
  partial(request, [`${ME}&access_token=${credentials.access_token}&fields=${fields.join(',')}`, {}]),
  invoker(0, 'json'),
  set(lensProp('user'), __, {}),
  set(lensProp('credentials'), credentials),
)());

README.md Outdated
@@ -48,6 +48,7 @@ Providers Setup
{
appId: '1234567890',
callback: 'fb1234567890://authorize',
scope: 'user_friends' // you can add some additional scope here
Copy link
Owner

@adamjmcgrath adamjmcgrath Apr 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"you can override the default scope here"

@pcofilada
Copy link
Contributor Author

@adamjmcgrath I already updated this PR.

@adamjmcgrath adamjmcgrath merged commit d37d4f5 into adamjmcgrath:master Apr 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants