首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >angular-ouath2-oidc在用户授予访问权限后不重定向

问angular-ouath2-oidc在用户授予访问权限后不重定向
EN

Stack Overflow用户
提问于 2019-05-04 09:14:12
回答 1查看 407关注 0票数 0

我使用angular-oauth2-oicd来请求用户授予对其basecamp3帐户的访问权限。应用程序可以很好地加载访问请求,但是当用户单击授权访问时,它不会重定向回index.html页面。它除了刷新页面什么也不做。我试过很多方法,但都没有用。

app.component.ts

代码语言:javascript
复制
export const authConfig: AuthConfig = {
  loginUrl: 'https://launchpad.37signals.com/authorization/new',
  issuer: 'https://launchpad.37signals.com/authorization/token',
  redirectUri: "localhost:8080/index.html",
  clientId: 'aeea63b486afddecf570c500e0ad54c0dd1be7da',
  clearHashAfterLogin: false,
  customQueryParams: {
    'type': 'web_server'
  }

};

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'ng-secure';

  constructor(private oauthService: OAuthService) {
    this.oauthService.configure(authConfig);
    this.oauthService.tokenValidationHandler = new JwksValidationHandler();
    this.oauthService.loadDiscoveryDocumentAndTryLogin();
  }

  login() {
    this.oauthService.initImplicitFlow(encodeURIComponent('localhost8080/index.html'));
  }

  logout() {
    this.oauthService.logOut();
  }

  get givenName() {
    const claims = this.oauthService.getIdentityClaims();
    if (!claims) {
      return null;
    }
    return claims['name'];
  }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-05-04 11:28:10

我弄明白了为什么它不会重定向。

oauth客户端将不允许重定向到localhost。必须是公网ip或实际域名。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55978691

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档