对接Alexa后台,enable 技能时需要通过我自己做的后台Oauth服务,经常会报错
Handling error: InvalidGrantException, Invalid authorization code: Dyki6G,
有人遇到类似这样的问题吗?还是我的浏览器配置有问题呢?
本地做的OAuth后台报错Handling error: InvalidGrantException, Invalid authorization code: Dyki6G
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
1条回答 默认 最新
Json-Huang 2019-10-17 12:11关注配置AuthorizationServerConfiguration认证节点使用JdbcAuthorizationCodeServices服务来存储和共享授权码通过数据库。
@Configuration @EnableAuthorizationServer protected static class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter implements EnvironmentAware { @Inject private DataSource dataSource; @Bean public TokenStore tokenStore() { return new JdbcTokenStore(dataSource); } // JdbcAuthorizationCodeServices stores authentication codes in a database. @Bean public JdbcAuthorizationCodeServices jdbcAuthorizationCodeServices() { return new JdbcAuthorizationCodeServices(dataSource); } @Inject @Qualifier("authenticationManagerBean") private AuthenticationManager authenticationManager; @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { endpoints .tokenStore(tokenStore()) .reuseRefreshTokens(false) .authenticationManager(authenticationManager) .authorizationCodeServices(jdbcAuthorizationCodeServices()); } }创建oauth_code表
CREATE TABLE oauth_code ( code VARCHAR(256), authentication LONGVARBINARY );评论 打赏 举报解决 2无用