【发布时间】:2018-08-22 07:54:32
【问题描述】:
我正在尝试为关注this tutorial 的用户刷新访问令牌。
但是,我得到了
{
"error":"unauthorized",
"error_description":"Full authentication is required to access this resource"
}
而且我看不到缺少什么。
以下是我在 Angular 应用程序中构造 oauth/refresh 请求的方式:
refreshToken() {
this.logger.info('Attempting to refresh access token');
const headers = new HttpHeaders()
.set('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8')
// CLIENT_ID:CLIENT_SECRET
.set('Authorization', 'Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=');
const payload = {
refresh_token: AuthenticationService.getRefreshToken(),
grant_type: 'refresh_token'
};
return this.http.post(environment.apiUrl + '/oauth/refresh',
payload, {headers: headers})
.pipe(map(r => r));
}
我在这里错过了什么?
【问题讨论】:
标签: spring spring-security oauth-2.0