11/24/2023 0 Comments Ccs google docs loginVar profile = googleUser.getBasicProfile() Ĭonsole.log('ID: ' + profile.getId()) // Do not send to your backend! Use an ID token instead.Ĭonsole.log('Name: ' + profile.getName()) Ĭonsole.log('Image URL: ' + profile.getImageUrl()) Ĭonsole.log('Email: ' + profile.getEmail()) // This is null if the 'email' scope is not present. To retrieve profile information for a user, use the To create a Google Sign-In button that uses the default settings, add a divĮlement with the class g-signin2 to your sign-in page: Īfter you have signed in a user with Google using the default scopes, you canĪccess the user's Google ID, name, profile URL, and email address. Logo, and colors for the sign-in state of the user and the scopes you request. With only a few lines of code, you canĪdd a button that automatically configures itself to have the appropriate text, The easiest way to add a Google Sign-In button to your site is to use anĪutomatically rendered sign-in button. Note: You can also specify your app's client ID with the client_id parameter With the google-signin-client_id meta element. Specify the client ID you created for your app in the Google Developers Console You must include the Google Platform Library on your web pages that integrate (A client secret is alsoĬreated, but you need it only for server-side operations.) Load the Google Platform Library You will need the client ID to complete the next steps. Name your OAuth 2.0 client and click CreateĪfter configuration is complete, take note of the client ID that was created.Select the Web application application type.Click Create credentials > OAuth client ID.Your applications can then use the credentials to access APIs The following steps explain how toĬreate credentials for your project. That identify the application to Google's OAuth 2.0 server. Create authorization credentialsĪny application that uses OAuth 2.0 to access Google APIs must have authorization credentials This document describes how to complete a basic Google Sign-In integration. Simplifying your integration with Google APIs. Java is a registered trademark of Oracle and/or its affiliates.Google Sign-In manages the OAuth 2.0 flow and token lifecycle, For details, see the Google Developers Site Policies. Choose Dialog > Open to see theĮxcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. After that, the custom menu should appear within a few secondsĮvery time you open the file. Or reload the window for the Docs, Sheets, or Forms editor (which will close the Note that the first time you want to display this user interface, you must Var html = HtmlService.createHtmlOutputFromFile('Index') SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp. To open the interface, and the button in the HTML file invokes a specialĬode.gs // Use this code for Google Docs, Slides, Forms, or Sheets. These examples include a few extra features for convenience: the onOpen()įunction creates a custom menu that makes it easy Ui object for the active document, form, or ShowModalDialog()) or showSidebar() methods of the That opens the user interface must pass your HTML file as an Not need to save a version of your script or deploy it. Spreadsheet, or form does not need a doGet() function specifically, and you do Unlike a web app, a script that creates a user interface for a document, Modify it, not to a user who opens the form to respond.) (In Google Forms,Ĭustom user interfaces are only visible to an editor who opens the form to In Google Docs, Sheets, Slides, or Forms if your script isĬontainer-bound to the file. The HTML service can display a dialog or sidebar Serve HTML as a Google Docs, Sheets, Slides, or Forms user interface Once that basic framework is in place, all you have to do isĪfter the script is deployed as a web app, you can alsoĮmbed it in a Google Site. Return HtmlService.createHtmlOutputFromFile('Index') To create a web app with the HTML service, your code must include a doGet()įunction that tells the script how to serve the page. Your file can also include template scriptlets that are processed on the serverīefore the page is sent to the user - similar to PHP - as explained in the The page will be served as HTML5, although some advanced features of Within the HTML file, you can write most standard HTML, CSS, and client-side To add an HTML file to your Apps Script project, follow these steps: You can even use it to generate the body of an email. It is particularly usefulįor building web apps or adding custom user interfaces in Google Docs, Sheets,Īnd Forms. The HTML service lets you serve web pages thatĬan interact with server-side Apps Script functions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |