如何使用jwt身份验证使用websockets?

时间:2019-06-02 04:13:57

标签: authentication websocket jwt adonis.js

我正在使用adonisjs中的websockets,当我未实现jwt身份验证时一切正常,但是当我包含它时,连接失败

this.connected = ws.withJwtToken(localStorage.getItem('token'))。connect()

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button btn = findViewById(R.id.btnChange);

        drawer = findViewById(R.id.dl);

        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this,drawer, R.string.navigation_drawer_open,R.string.navigation_drawer_close);

        drawer.addDrawerListener(toggle);
        toggle.syncState();

        //Not nav
        Switch OnOff = (Switch) findViewById(R.id.OnOff);
        NumberPicker numberPicker2 = findViewById(R.id.numberPicker2);
        NumberPicker numberPicker = findViewById(R.id.numberPicker);
        numberPicker.setMinValue(00);
        numberPicker2.setMinValue(00);
        numberPicker2.setMaxValue(23);
        numberPicker.setMaxValue(23);

       OnOff.setTextOff("On");
       OnOff.setTextOn("Off");
        //not nav

    }

“错误”代码行在控制台中显示“找不到模块'Adonis /中间件/会话”

我不知道文件的配置是否因为auth的类型而改变,有人知道吗?

0 个答案:

没有答案