Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.

Client connection required, even when authenticate service is in browser #67

Closed
FossPrime opened this issue Sep 8, 2017 · 1 comment

Comments

@FossPrime
Copy link

FossPrime commented Sep 8, 2017

Steps to reproduce

  1. setup feathers in browser with an authenticate service... no server needed
  2. use feathers-authentication-client to interact/login to your in browser service

Expected behavior

Login success messages

Actual behavior

screen shot 2017-09-08 at 11 37 57 am

System configuration

Here is the only file I modified main.js from the vue init webpack template

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

/**  start feathers stuff **/

import feathers from 'feathers'
import memory from 'feathers-memory'
import auth from 'feathers-authentication-client'
import hooks from 'feathers-hooks'

// Create a feathers instance.
const app = feathers()
  .configure(hooks())
  // Configure feathers-authentication
  .configure(auth({ secret: 'super secret' }))
  .use('/users', memory())
  .use('/authenticate', memory())

// Create a user that we can use to log in
var User = {
  email: 'admin@feathersjs.com',
  password: 'admin',
  permissions: ['*']
}

app.service('users').create(User).then(user => {
  console.log('Created default user', user)
}).catch(console.error)

debugger
app.service('authenticate').hooks({
  before (create) {
    console.log('auth created')
  }
})

app.authenticate({
  strategy: 'local',
  email: 'admin@feathersjs.com',
  password: 'admin'
})
.then(response => {
  console.log('Authenticated!', response)
})

// Create an in-memory Feathers service with a default page size of 2 items
// and a maximum size of 4
app.use('/message', memory({
  paginate: {
    default: 2,
    max: 4
  }
}))

app.service('message').create({
  text: 'Server message',
  read: false
}).then(function (message) {
  console.log('Created message', message)
})

/** end feathers stuff **/

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  template: '<App/>',
  components: { App }
})

Module versions (especially the part that's not working):
feathers 2.2.0
feathers-authentication-client 0.3.3

NodeJS version:
8

Browser Version:
Chrome 61

Module Loader:
Webpack from Vue Webpack template

UPDATE:

The before Authenticate hook never fires... it just goes straight into the passport client connection error.

@FossPrime FossPrime changed the title Client connection required, even when service is in browser Client connection required, even when authenticate service is in browser Sep 11, 2017
@daffl
Copy link
Member

daffl commented Apr 22, 2019

This has been fixed in Feathers v4 authentication. Please see the migration guide for more information. Closing this issue in order to archive this repository. Related issues can be opened at the new code location in the Feathers main repository.

@daffl daffl closed this as completed Apr 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants