Adding Multiple OAuth2 Strategies Not working
See original GitHub issueI implemented more than one strategy like this:
strategies: [
NbPasswordAuthStrategy.setup({
name: 'xxx',
baseEndpoint: '/api/',
login: {
endpoint: 'login/xxx',
method: 'post'
},
token: {
class: NbAuthJWTToken,
key: 'data.token'
},
errors: {
key: 'error.message'
},
}),
NbPasswordAuthStrategy.setup({
name: 'yyy',
baseEndpoint: '/api/',
login: {
endpoint: 'login',
method: 'post'
},
register: {
endpoint: 'register',
method: 'post'
},
token: {
class: NbAuthJWTToken,
key: 'data.token'
},
errors: {
key: 'error.message'
}
}),
But when trying to use xxx strategy, it always returns “There is no Auth Strategy registered under ‘xxx’ name” error:
this.authService.authenticate('xxx', params)
.subscribe((result: NbAuthResult) => {
Was trying to debug by adding log build result of auth.service.js:
function (strategyName) {
console.log('Strategies: ', this.strategies);
var found = this.strategies.find(function (strategy) { return strategy.getName() === strategyName; });
if (!found) {
throw new TypeError("There is no Auth Strategy registered under '" + strategyName + "' name");
}
return found;
};
But in the result the strategies does not have ‘name’ field:
(2) [NbPasswordAuthStrategy, NbPasswordAuthStrategy]
0
:
NbPasswordAuthStrategy
defaultOptions
:
NbPasswordAuthStrategyOptions {baseEndpoint: "/api/auth/", login: {…}, register: {…}, requestPass: {…}, resetPass: {…}, …}
http
:
HttpClient {handler: HttpInterceptingHandler}
options
:
{baseEndpoint: "/api/", login: {…}, register: {…}, requestPass: {…}, resetPass: {…}, …}
route
:
ActivatedRoute {url: BehaviorSubject, params: BehaviorSubject, queryParams: BehaviorSubject, fragment: BehaviorSubject, data: BehaviorSubject, …}
__proto__
:
NbAuthStrategy
1
:
NbPasswordAuthStrategy```
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:18 (3 by maintainers)
Top Results From Across the Web
Complete Guide to Multi-Provider OAuth 2 Authorization in ...
Learn how to build an OAuth2 authorization using multiple social providers with cross-sync and multiple logged-in accounts using Nodejs and ...
Read more >OAuth 2 Access Token Usage Strategies for Multiple ...
When an application consumes a variety of different APIs, often all endpoints require an OAuth 2 access token issued from a common Identity ......
Read more >How can I use multiple Oauth2 SSO Servers on a single ...
I'd like to give users the option to login to a Spring Boot web application using their Google or Facebook account. I checked...
Read more >Authorization Errors | Device Access - Google Developers
Use this guide to troubleshoot the most common errors during this process. Troubleshooting. To learn more about Google OAuth, see Using OAuth ...
Read more >Firebase Authentication
Firebase Authentication lets you add an end-to-end identity solution to your app for ... With some additional code, you'll be able to add...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
any update on the fix or documentation update?
Right, one more step and it should be fine as a workaround: