HTTP Responses - Episode 11.2 | Apps Script ~ URL Fetch Service

Поделиться
HTML-код
  • Опубликовано: 8 ноя 2024

Комментарии • 13

  • @chuckditto
    @chuckditto 4 года назад

    I like the idea of the HTTP feature in the Google Apps eco system. Your example is clear and useful in terms of explaining the feature and how it works within the Google Apps eco system. I am looking for a different use case to see whether there is value in the feature for my uses-got any ideas-sounds crazy asking you for a good use case for myself-LOL.

  • @danielcir8675
    @danielcir8675 4 года назад

    had no idea OneDrive was accessible from GAS!!! amazing!!! thanks for the tutorial!!!

  • @danielcir8675
    @danielcir8675 4 года назад

    Hi David, the lines 41 thru 44 on Episode2.gs return the following error:
    Exception: Blob object must have non-null name for this operation. (line 44, file "fetch")
    do you know what's going on?
    Thanks

  • @Anzeljaeg
    @Anzeljaeg 10 месяцев назад

    Thanks so much

  • @seanconnors3356
    @seanconnors3356 3 года назад

    I am just curious about the security of fetching information and GAS in general. I am not a data security expert but I work alongside an IT company that doesn't even know what GAS is and I feel like they are going to, out of ignorance, prohibit it's usage because of data security concerns. If I am fetching information from a https with authentication/encryption required, I assume that from my end with google appscript, that the information is completely secure. The same goes for sending information from one sheet to an email or another sheet. I have never hosted and published any of the information.

    • @DavidWeissProgramming
      @DavidWeissProgramming  3 года назад +1

      Hi Sean, great question! I am not a data security expert either, but like you, I'd assume that a product this large coming from Google would have a great deal of security measure built into it, similar to the ones they use to protect user data in Sheets, Docs, and Gmail. Try posting this question here to see if anyone else can give a more detailed answer: groups.google.com/g/google-apps-script-community

    • @seanconnors3356
      @seanconnors3356 3 года назад

      @@DavidWeissProgramming I read that all fetch handling from Google servers is automatically encrypted after asking this. Thank you for all your videos. I have subscribed and watched most of them. You have been of great importance in my career.

    • @DavidWeissProgramming
      @DavidWeissProgramming  3 года назад

      @@seanconnors3356 Thanks that means a lot! Are there any specific topics you'd like to see in the next videos?

    • @seanconnors3356
      @seanconnors3356 3 года назад

      @@DavidWeissProgramming I'm currently doing API work and Google Sheets work in GAS that seems never ending, so I can't think of anything new right now but I'm always interested in anything appscript. Thought the Microsoft compatibility was very cool (although I dislike Microsoft) since I hadn't seen anyone else post anything related to that and Microsoft itself has no intention of making anything work within their apps online like appscript can. There is tons of stuff, obviously, for client side Excel like with VBA but nothing for excel online that can transfer info from one sheet to another.

  • @josericardo3015
    @josericardo3015 3 года назад

    Hi David!
    Could you give us some instructions how to get the "id" and "refresh token" in Microsoft?
    tks

    • @DavidWeissProgramming
      @DavidWeissProgramming  3 года назад +1

      Hi Jose! Great question! I imagined this question would be asked sooner or later :)
      Follow the below steps to generate your own Client ID and Refresh Token:
      1. Go to portal.azure.com/#home (You'll need an account with Microsoft to access this website. If you don't have one, create one!)
      2. In the top search box, search for 'App registrations' and follow the link to that service.
      3. After being redirected, click on the button 'New Registration'.
      4. The name can be anything, such as "Apps Script Client", under 'Supported account types', make sure 'Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)' is selected, leave Redirect URI blank for now, finally click "Register".
      5. After the app has been registered, copy the Application (client) ID. This is your client ID. It should look something like this: 902fc9a0-e9cd-41d3-9d47-eb6bb0a32b20
      6. Right next to the client ID is a button to 'Add a Redirect URI'. Click it.
      7. Next, click 'Add a platform' > 'Mobile & Desktop Applications' > and select all 3 redirect URIs by clicking on the checkboxes. Most importantly you'll want to select this redirect URI: login.microsoftonline.com/common/oauth2/nativeclient
      8. After hitting 'Configure', open up a text file and paste the following code into it, replacing "your application ID goes here" with the Client ID of your Azure app you just made:
      $clientId = "your application ID goes here"
      Start-Process "login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=$clientId&scope=files.read offline_access&response_type=code&redirect_uri=login.live.com/oauth20_desktop.srf"
      $code = Read-Host "Please enter the code"
      $response = Invoke-WebRequest login.microsoftonline.com/common/oauth2/v2.0/token -ContentType application/x-www-form-urlencoded -Method POST -Body "client_id=$clientid&redirect_uri=login.live.com/oauth20_desktop.srf&code=$code&grant_type=authorization_code"
      Write-Output "Refresh token: " ($response.Content | ConvertFrom-Json).refresh_token
      9. Save this file as GetRefreshToken.ps1 (The name doesn't matter, as long as it's saved as a .ps1 file.
      10. Open a terminal window on your mac (or PowerShell if you have windows), navigate to the directory this file is stored, and run it. I have a mac, so after getting to the same directory, I typed in the command 'pwsh' (you may need to install PowerShell), and then once inside the PowerShell command prompt, I typed the command ./GetRefreshToken.ps1.
      11. Once you execute this command, you'll be brought to a webpage and a prompt will appear, asking "Let this app access your info?" Click 'Yes'.
      12. After this, you'll be redirected to a blank page. Look at the URL in the address bar. It'll read something like this: login.live.com/oauth20_desktop.srf?code=M.R3_BAY.30b9cf9a-2553-f827-2c80-d91b07150e92&lc=1033. Copy the part after code= and before &lc=1033.
      13. Paste this code back into your terminal window.
      14. Once you hit enter, it should display for you your refresh token. You now have both your clientID and your refresh token.
      This is a long process, so feel free to ask me any questions if you get stuck!

    • @josericardo3015
      @josericardo3015 3 года назад

      @@DavidWeissProgramming Thank you very much for the detailed instructions!
      After all I am still in trouble!
      As your item 12 when I have to copy the code there is no "&lc=1033". I have just found "&session_state".
      Here is the message that I got in the App Script Code Editor:
      Exception: Request failed for graph.microsoft.com returned code 400. Truncated server response: {
      "error": {
      "code": "BadRequest",
      "message": "Resource not found for the segment 'rootB5')'.",
      "innerError": {
      "date": "2... (use muteHttpExceptions option to examine full response)

  • @cuneiformscript2665
    @cuneiformscript2665 4 года назад

    🙏🏻👏👍🏻