florianheinemann / passport-dropbox-oauth2

Passport strategy for authenticating with Dropbox using the OAuth 2.0 API
MIT License
31 stars 8 forks source link

OAuth fails when using Dropbox Business API key #11

Open chico opened 7 years ago

chico commented 7 years ago

Fail to fetch user profile error occurs at https://github.com/florianheinemann/passport-dropbox-oauth2/blob/master/lib/passport-dropbox-oauth2/strategy.js#L120-L121.

The error occurs because the Dropbox Business API key does not have the permission to get an individual user's profile.

A potential fix would be to fetch the team member profiles, and select the profile with the role of team_admin. See https://www.dropbox.com/developers/documentation/http/teams#team-members-list.