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

POST to auth/facebook for FacebookTokenStrategy 404? #447

Closed
meatwallace opened this Issue Mar 16, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@meatwallace
Copy link

meatwallace commented Mar 16, 2017

Hey guys,
Trying to migrate to 1.x right now. Previously had been using tokenStrategy with success in my setup. I have a GraphQL server handling auth with mutations, and just using axios to post to the endpoints. I had both the FacebookStrategy and FacebookTokenStrategy enabled, using the token strategy in my React Native app. Shifting to feathers-auth 1.x, having issues getting the same setup working. Even in a barebones situation where I exclusively use the token strategy:

  app
    .configure(authentication({
      secret: process.env.TOKEN,
      facebook: {
        clientID: process.env.FACEBOOK_CLIENT_ID,
        clientSecret: process.env.FACEBOOK_CLIENT_SECRET,
        scope: [ 'public_profile', 'email' ],
      },
    }))
    .configure(local())
    .configure(jwt())
    .configure(oauth2({
      name: 'facebook',
      Strategy: FacebookTokenStrategy,
    }))

When I POST to the /auth/facebook endpoint, I get a 404 - Route: http://localhost/auth/facebook - Page not found from axios. I've tried giving it varying end points etc to no luck. If I'm not using feathers-authentication-client, how do I approach this...?

Thanks for any help.

@meatwallace

This comment has been minimized.

Copy link
Author

meatwallace commented Mar 16, 2017

This can be closed. About 10 mins after I posted it I had a "duh" moment and worked it out.

For anyone else trying this approach... /auth/facebook works for the typical OAuth flow with FacebookStrategy, but if you're using token auth with FacebookTokenStrategy, POST to your main authentication endpoint. Using default settings, this is /authentication. The request should just pass your access_token, optionally a refresh_token, and strategy, where strategy is the name of your configured OAuth strat. In this case, I named my token strategy facebook-token, and left the regular strategy as just facebook.

@marshallswain

This comment has been minimized.

Copy link
Member

marshallswain commented Mar 16, 2017

Thanks @meatwallace

@mattwoolnough

This comment has been minimized.

Copy link

mattwoolnough commented Mar 17, 2017

@meatwallace, can you provide a Curl example of that POST? I'm getting 404 on the /authentication path, no matter what format I use. thanks

@daffl

This comment has been minimized.

Copy link
Member

daffl commented Mar 17, 2017

For v0.7.x the endpoint is auth/local as described here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.