ajax身份验证请求头部加Authorization请求失败

我是用微软身份认证,获取token,在头部加的client_id和client_secret,返回总是失败,用控制台程序调试却是成功的,求大神指导:

` axios.defaults.headers.common['Authorization'] ="Basic" +util.base64encode(config.client_id+":"+config.client_secret);

LoginForm: {
                Username: 'admin',
                Password: 'ddd88227793',
                grant_type:'password'
                }
 requestLogin(_this.LoginForm).then(data => {
                                    this.loading = false;
                                    debugger
                                    let { msg, code, user } = data;
                                    if (code !== 200) {
                                        this.$notify({
                                        title: '错误',
                                        message: msg,
                                        type: 'error'
                                        });
                                    } else {
                                    //    sessionStorage.setItem('user', JSON.stringify(user));
                                        this.$router.push({ path: '/Main' });
                                    }
                                }).catch(function (error) {
                                    console.log(error);
                                });`
                                
                                
                                

clipboard.png

阅读 3.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题