Hello All, I have a Angular 8 application on the front end and Azure Function App (API's) in the back end. My Application is registered on Azure portal
REQUIREMENT: I need to get JWT token from Azure B2C and whenever there is a call to the Api from front end the jwt token needs to be sebnd into the header of that request. My pain is that i am not able to get the JWT token below is my method call , Any urgent help is appreciated Note: Anybody who would be able to get this working will get a appreciation of $50 from me You can connect me on [email protected]/[email protected] export class AuthService { private url: string = 'https://login.microsoftonline.com/comcastcorp.onmicrosoft.com/oauth2/v2.0/token?HTTP/1.1' ; constructor(private http: HttpClient, private jwtHelper: JwtHelperService ) { } acquiretoken(): Observable<any> { let headers = new HttpHeaders({ 'Content-Type': 'application/x-www-form-urlencoded' }); let body = new URLSearchParams(); body.set('resource_name', "byoddev.onmicrosoft.com"); body.set('grant_type', "client_credentials"); body.set('client_id', "Z9PXTnvUvjQ/ButPv5uKAjoSXSXH/Up4bXNlC9DD0lg="); body.set('client_secret', "e2d46ead-82e7-4ccc-ab4e-a46b076e0eef"); return this.http.post<any>(this.url, body.toString(), { headers: headers }).pipe( map(jwt => { if (jwt && jwt.access_token) { localStorage.setItem('apitoken', JSON.stringify(jwt)) } }) ); } -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/angular/0aaade74-d4c6-4e59-b6cc-138e45c41972%40googlegroups.com.
