googleworkspace / md2googleslides

Generate Google Slides from markdown
Apache License 2.0
4.48k stars 284 forks source link

Oauth blocked access #95

Open shaktee opened 3 years ago

shaktee commented 3 years ago

image

I am unable to get beyond the authorization part. I'm using my personal account and it has never previously reported any blocked apps.

jonathan-chin commented 3 years ago

I was finally able to get this working. I know that there's an unmerged PR that might have fixed this but it seems stuck in limbo. here's how I fixed it (it gets dirty):

  1. follow the installation and usage, specifically to get OAuth client credentials.
  2. request the following permission scopes: https://www.googleapis.com/auth/presentations, https://www.googleapis.com/auth/drive (might require more. I added a bunch but I think these 2 are the only ones needed)
  3. edit the source code: bin/md2gslides.js lines 129 and 130:
    const options = {                                                                                                                                                                                      
        clientId: 'YOUR CLIENT ID',                                                                                                              
        clientSecret: 'YOUR CLIENT SECRET',                                                                                                                                                          
        filePath: STORED_CREDENTIALS_PATH,                                                                                                                                                                 
        prompt: prompt,                                                                                                                                                                                    
    };

let me know if that works for you. I'm happy to help, since I rely on this pretty heavily and can imagine others might too.

zseta commented 3 years ago

thanks @jonathan-chin it works for me. I wonder why clientSecret and clientId are hardcoded..

rumiiinator commented 3 years ago

Hi just want to have a quick follow up on this thread. I tried the similar approach mentioned above, which let me enter this stage image

After checking both permission, the page will be redirected to a page to copy the authorized code. But every time I paste the code to the terminal, I will get the following errors: Unable to generate slides: Error: EAGAIN: resource temporarily unavailable, read ... at generateSlides (....) { errno: -35, syscall: 'read', code: 'EAGAIN' } Wonder anyone has any idea about how to overcome/walk around this ....?

wescpy commented 3 years ago

Ok, I ran into this last night, dug around, and found out a few things:

  1. @jonathan-chin 's fix is legit. In fact, I told users the same thing last year, so it's an "old" fix.
  2. I also fixed this bug and the original one with this patch in Apr 2020 which was finally merged Jun 2021.
  3. However because the latest release tag is still v0.5, you're not installing the fix.
  4. IOW, @zseta the reason why it's hardcoded requiring the fix-by-hand, is because you've installed the version from Apr 2019, not from Jun 2021 or newer.
  5. Bottom-line: you either go w/the patch by hand, or you clone the repo, compile with npm run compile, then replace what's in your /usr/local/bin (or wherever you've got it installed) with the latest one which s/b in your bin after compilation.
  6. This bug will likely be closed as a dupe of the original one.
  7. I pinged the maintainer last night and asked them to rev the version, so hopefully this will be a non-issue soon, but if not, at least you know what to do now. :-)
GuiMarthe commented 3 years ago

No updates on this? Seems fixable, no?

wescpy commented 2 years ago

Yes, it's fixable, but the maintainer is pretty busy these days, and there are 2 workarounds: a) the repo has working code or b) patch the release you installed w/npm. So just follow the instructions above until they get a chance to "cut" a new release (tag).

alexpdp7 commented 2 years ago

Also you can npm-install googleworkspace/md2googleslides instead of md2gslides. That will pull the latest from GitHub, and it seems to work correctly. Given that the instructions in the README are now invalid, I'd edit them to change the installation method until a release can be made.

wangtiejun001 commented 2 years ago

2. googleapis

I still met the "This app is blocked" issue just as the snapshot that shaktee posted.

Is there anyone who can help to identify the possible mis-configurations from my below steps? Thanks...

What I tried:

  1. OAuth client credential is generated.
  2. Permission scope is added(I opened all permission scopes for testing the OAth issue).
  3. bin/md2gslides.js is modifed.
  4. client_id.json file is copied to .md2googleslides folder.

More about my config:

  1. inorder to get the credential, I configured the consent screen which requires a https service: oauth_consent_screen_config
  2. For creating the OAuth Client ID, I used the "desktop app/web application" rather than "Computer Application" as mentioned in the README.md. Because I cannot find the item. OAuth_client_service_type

More about my env:

  1. A personal gcp account.
  2. I ran the code from my local pc, while blocked at the "This app is blocked" page.
  3. I then ran the code from the server which I run for the https service(to ensure the origin is the same as the domain i used for the consent screen), still not work.
wescpy commented 2 years ago

Please read the comments above. The code works; there's no issue with your permissions. It's just that you're using the code from 2019. The maintainer is too tied up to cut another release, so use one of the alternative methods described in other comments for now.