Authentication in Angular 6

21 views
Skip to first unread message

eshwar chettri

unread,
Aug 18, 2018, 12:51:33 PM8/18/18
to Angular and AngularJS discussion
Hi,
I'am new to angular , I want to make Gmail Api authentication with angular 6. Currently I'am trying to authenticate through spring boot but I'am getting an CORS error, Could any one help me with some example or reference.
below is the error I'am getting

gmailAuth(url:string){ //This url I'am getting from spring boot controller
// window.open(url,"_blank" );
  
    let tokenHeader = new Headers({
    'Content-Type' : 'application/json',
    'x-auth-token' : localStorage.getItem('xAuthToken')
  });
console.log(url);
  return this.http.post(url, {headers : tokenHeader});
}

1.PNG


3.PNG2.PNG


Sander Elias

unread,
Aug 18, 2018, 11:47:11 PM8/18/18
to Angular and AngularJS discussion
hi Eshwar,

First, that comes to mind is that you didn't provide the correct URL in your google-dash. It's a while ago I used it, but IIRC that will cause a CORS issue, and rightfully so :)

Regards
Sander

eshwar chettri

unread,
Aug 19, 2018, 4:57:39 AM8/19/18
to Angular and AngularJS discussion
Hi sander I dint get you.. you mean in google console

Sander Elias

unread,
Aug 19, 2018, 8:55:25 AM8/19/18
to Angular and AngularJS discussion
Yes, the google console. sorry, I'm so used calling it the google dash..

Regards
Sander

eshwar chettri

unread,
Aug 19, 2018, 9:33:47 AM8/19/18
to Angular and AngularJS discussion
I have provided both redirect url and origin url

eshwar chettri

unread,
Aug 19, 2018, 10:03:11 PM8/19/18
to Angular and AngularJS discussion

console.PNG


3.PNG2.PNG


Reply all
Reply to author
Forward
0 new messages