Implement OAuth 2.0 to existing framework7 App

Hi there ,

We are looking for some help to implement OAuth 2.0 with the framework7 existing App to use the google auth , if interested please let me know

Kind Regards

Try Firebase, done is just a couple lines of code: https://firebase.google.com/docs/auth/web/google-signin

Hello there,

Trust you are keeping well!!

Iā€™d glad to assist you for same.

would you be able to drop us an email to get an estimate?

Email Me : carter(AT)cisinlabs(DOT)com

Kind regards,
Carter W

Hello,
I can help you.
BR
Trish

in your page 

<script async defer src="https://apis.google.com/js/api.js" 

      onload="this.onload=function(){};handleClientLoad()" 

      onreadystatechange="if (this.readyState === 'complete') this.onload()">

      

     //   https://console.developers.google.com/apis/credentials?project=_
      // In your API Console project, add a JavaScript origin that corresponds
      //   to the domain where you will be running the script.
      var clientId = 'YourClientID';

      // Enter one or more authorization scopes. Refer to the documentation for
      // the API or https://developers.google.com/people/v1/how-tos/authorizing
      // for details.
      var scopes = 'profile email';

    

 
      function handleClientLoad() {
        // Load the API client and auth2 library
        gapi.load('client:auth2', initClient);

        
      }

      function initClient() {
       
        app.preloader.show();
        gapi.client.init({
            apiKey: apiKey,
            discoveryDocs: discoveryDocs,
            clientId: clientId,
            scope: scopes
        }).then(function () {
          // Listen for sign-in state changes.
          gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);

          // Handle the initial sign-in state.
          updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());

          

          
        });
        
        

      }
      function handleSuccess (){
        console.log('success');
      }
      function handleFailure (){
        console.log('Failure');
      }
      function updateSigninStatus(isSignedIn) {

       
        if (isSignedIn) {
          
          // console.log('get user profile');
          profile = gapi.auth2.getAuthInstance().currentUser.get().getBasicProfile();
	  //set your app data container 
	  //dont forget to declare the googleprofile variable in your app
          app.data.googleprofile=profile;
         
          
          var id_token =  gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().id_token;
          // console.log('Google Token ID: ' + id_token);
          var thisemail=profile.getEmail();
         

         

          
        } else {
          //
	  // console.log('Not signed in Google ');
        }
        app.preloader.hide();
       
      }
      //assign to your buttons
      function handleAuthClick(event) {
        // console.log('no login here');
        // return;
        // initClient();
        app.preloader.show();

        
       
        gapi.auth2.getAuthInstance().signIn();//.then(function(resp){console.log(resp)});
        
      }

      function handleSignoutClick(event) {

        console.log('Signing out');
       
        app.preloader.show();
        
        handleClientLoad()
        initClient() ;
       
      }

      // Load the API and make an API call.  Display the results on the screen.
      function makeApiCall() {
        // gapi.client.people.people.get({
        //   'resourceName': 'people/me',
        //   'requestMask.includeField': 'person.names'
        // }).then(function(resp) {
        // //   var p = document.createElement('p');
        //   var name = resp.result.names[0].givenName;
        // //   p.appendChild(document.createTextNode('Hello, '+name+'!'));
        // //   document.getElementById('content').appendChild(p);\
        // //   console.log(resp);
          
          
        // });
      }

    </script>
1 Like