I hereby claim:
- I am alx-andru on github.
- I am alx_andru (https://keybase.io/alx_andru) on keybase.
- I have a public key ASDXHHo7C87MoRYcOFAGwBLzZZtmgi4GoNZutgjDM2JY8Ao
To claim this, I am signing this object:
| import { | |
| Injectable, | |
| Inject, | |
| Optional, | |
| NgZone, | |
| PLATFORM_ID, | |
| } from "@angular/core"; | |
| import { Observable, of, from } from "rxjs"; | |
| import { | |
| switchMap, |
| |
I hereby claim:
To claim this, I am signing this object:
| NgOidcClientModule.forRoot({ | |
| oidc_config: { | |
| authority: | |
| 'https://login.microsoftonline.com/TENANT_ID/v2.0', | |
| client_id: 'CLIENT_ID', | |
| redirect_uri: 'https://localhost:4200/callback.html', | |
| response_type: 'id_token token', | |
| scope: 'openid profile offline_access', | |
| loadUserInfo: false, | |
| post_logout_redirect_uri: |
| export function logout(reducer: ActionReducer<any>): ActionReducer<any> { | |
| return function(state: any, action: any) { | |
| // Reset state if user logs out | |
| if (action.type === OidcActions.OidcActionTypes.OnUserSignedOut) { | |
| return reducer(undefined, action); | |
| } | |
| return reducer(state, action); | |
| }; | |
| } | |
| @Effect() | |
| loadUser$: Observable<Action> = this.actions$.pipe( | |
| ofType(UserActionTypes.USER_GET_ME, OidcActions.OidcActionTypes.UserFound), | |
| switchMap(() => | |
| this.userService.getMe().pipe( | |
| first(), | |
| map((user: User) => { | |
| return new GetUserMeSuccess(user); | |
| }), | |
| catchError(error => { |
| ... | |
| export class OidcEffectsService { | |
| constructor(private actions$: Actions, private router: Router) {} | |
| @Effect({ dispatch: false }) | |
| onUserSignedOut$: Observable<Action> = this.actions$.pipe( | |
| ofType(OidcActions.OidcActionTypes.OnUserSignedOut), | |
| tap(args => { | |
| this.router.navigate(['/home']); | |
| }) |
| NgOidcClientModule.forRoot({ | |
| oidc_config: { | |
| authority: 'YOUR_DOMAIN', // e.g. https://dev-133788.oktapreview.com | |
| client_id: 'YOUR_CLIENT_ID', | |
| redirect_uri: 'http://localhost:4200/callback.html', | |
| response_type: 'id_token token', | |
| scope: 'openid profile offline_access', | |
| post_logout_redirect_uri: 'http://localhost:4200/signout-callback.html', | |
| silent_redirect_uri: 'http://localhost:4200/renew-callback.html', | |
| automaticSilentRenew: true |
| NgOidcClientModule.forRoot({ | |
| oidc_config: { | |
| authority: 'https://YOUR_DOMAIN.auth0.com', // e.g. https://ngOidcClient.auth0.com/' | |
| client_id: 'YOUR_CLIENT_ID', | |
| redirect_uri: 'http://localhost:4200/callback.html', | |
| response_type: 'id_token token', | |
| scope: 'openid profile offline_access api1', | |
| post_logout_redirect_uri: 'http://localhost:4200/signout-callback.html', | |
| silent_redirect_uri: 'http://localhost:4200/renew-callback.html', | |
| automaticSilentRenew: true, |
| ... | |
| export class HomeComponent implements OnInit { | |
| userInfo$: Observable<User>; | |
| constructor(private http: HttpClient, private oidcFacade: OidcFacade) {} | |
| ngOnInit() {} | |
| checkUserInfo() { | |
| const identityProviderUrl = this.oidcFacade.getOidcClient().settings.authority; |