S
S
sdgroup142019-08-13 14:27:32
Angular
sdgroup14, 2019-08-13 14:27:32

How to make google Oauth 2.0 Angular 2+?

Generally there is such a benefit. https://developers.google.com/identity/protocols/O... Along with it, I have found a lot of others, but it doesn’t work for me at the root after a reverse redirect (when I get back to my domain after a successful login to Google page) get data to send it further using your api accessToken.
Do not offer different modules. I already did through them, and through firebase too. firebase takes too long to load, and other modules work through a modal, but I only need it through a redirect. Always either false comes, or nothing comes at all, maybe I'm doing something wrong?

//head
  <script src="https://apis.google.com/js/api.js"></script>

myComponent
BtnClick(){
    window.location.href = 'https://accounts.google.com/o/oauth2/v2/auth?client_id=*******&response_type=code&scope=openid%20email&redirect_uri=https://dm.devmarine.pp.ua&state=*****';

}

onInit(){
      gapi.load('client', () => {
      console.log('loaded');
      gapi.client.init({
        apiKey: ********,
        clientId: ********,
        scope: 'profile'
      });

      console.log(gapi.auth2.getAuthInstance());
      console.log(gapi.auth2.getAuthInstance().isSignedIn.get());
    });
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question