Skip to content
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

getIdentities() returns Error #1

Closed
nickvelloff opened this issue Oct 23, 2015 · 14 comments
Closed

getIdentities() returns Error #1

nickvelloff opened this issue Oct 23, 2015 · 14 comments

Comments

@nickvelloff
Copy link

I may be just doing it wrong but the User and User(id) return, identities do not. The token I am using is provided by Passport.

The current user is Nick Velloff

Error, getIdentities(): TypeMismatch(Expected .Some(Provider), got .None)

Error, getPrivateGitHubToken(): Bad request: 403

Error, getPublicGitHubToken(): Bad request: 403

The user with id a UUID is Nick Velloff

Error, deleteIdentity(-1): Bad request: 404

@nickvelloff
Copy link
Author

Further investigation. Identities do actually return but the result is not .Success(identities)

[{
    "id": an int,
    "url": "https://www.facebook.com/app_scoped_user_id/someid/",
    "username": "Nick Velloff",
    "provider": "facebook",
    "icon": "facebook",
    "description": "Identity only",
    "image": null,
    "location": null,
    "bio": null,
    "canRemove": true
}, {
    "id": an int,
    "url": "https://github.com/nickvelloff",
    "username": "nickvelloff",
    "provider": "github",
    "icon": "github",
    "description": "Identity only",
    "image": "https://avatars.githubusercontent.com/u/885369?v=3",
    "location": "San Francisco, CA",
    "bio": null,
    "canRemove": true
}, {
    "id": an int,
    "url": "https://github.com/nickvelloff",
    "username": "nickvelloff",
    "provider": "github_public",
    "icon": "github",
    "description": "Public repository access",
    "image": null,
    "location": null,
    "bio": null,
    "canRemove": true
}]

@nickvelloff
Copy link
Author

Additionally the requests for https://passport.thegrid.io/api/user/github and https://passport.thegrid.io/api/user/github_private return Missing authentication scope

@paulyoung
Copy link
Contributor

Error, getIdentities(): TypeMismatch(Expected .Some(Provider), got .None)

You have a provider with a value of github_public which isn't in the Provider enum. I think this should probably just be github.

@paulyoung
Copy link
Contributor

Missing authentication scope

This suggests that when you obtained the access token you're using, the scopes github and github_private weren't present.

@nickvelloff
Copy link
Author

This suggests that when you obtained the access token you're using, the scopes github and github_private weren't present.

Indeed these scopes are not present. "scope": ["content_management", "website_management", "update_profile"],

I suppose we need to ask for these scopes if we want them.

@nickvelloff
Copy link
Author

You have a provider with a value of github_public which isn't in the Provider enum. I think this should probably just be github.

I don't know how to proceed resolving this. Likely many users could have this issue unless I'm an edge case having had my Passport account so long.

@paulyoung
Copy link
Contributor

I think this is probably a bug in the API. @trustmaster would you agree? That this should be github instead of github_public?

@nickvelloff
Copy link
Author

FWIW, the descriptions for "provider": "github" and "provider": "github_public" are different - "description": "Identity only" and "description": "Public repository access" respectively.

@trustmaster
Copy link

https://passport.thegrid.io/api/user/github and https://passport.thegrid.io/api/user/github_private are currently used by Flowhub to obtain GitHub tokens to talk to the GitHub API. And they require the following combinations to be present in scope when initiating the OAuth2 dance to obtain a bearer token: ['github'] or ['github', 'github_private'].

github, github_public and github_private are all valid members of the Provider set as they serve different purpose. This is somewhat unknown to The Grid users, but for Flowhub they make sense, at least technically.

@nickvelloff
Copy link
Author

@trustmaster Must github be present from a client perspective, or is this handled on the Passport side?

@trustmaster
Copy link

@nickvelloff If you want to be able to call get*GithubToken() methods, then github or/and github_private should be present in authentication scopes. This prevents quite sensitive Github tokens from unauthorized leaks.

@nickvelloff
Copy link
Author

I'm not sure why the iOS or generally a mobile client would need this, so unless @paulyoung you think otherwise we shouldn't request it. Thanks @trustmaster!

@paulyoung
Copy link
Contributor

@nickvelloff in terms of The Grid, not right now.

@paulyoung
Copy link
Contributor

The missing providers were added in the-grid/Disc@d2f288b and this demo project was update to use that version.

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

No branches or pull requests

3 participants