node-red-contrib-oauth2 icon indicating copy to clipboard operation
node-red-contrib-oauth2 copied to clipboard

Google API Example

Open Shazib opened this issue 2 years ago • 5 comments

Would it be possible to get an example of how to use this with google API?

I'm getting a HTTP 200 back, but the payload is a HTML sign-in page.

I'm guessing this is the redirect to the user sign-in page but i'm not sure how to set up the redirect to work.

I've got the redirect uri /oauth2/redirec open

Thanks.

Shazib avatar Oct 08 '23 22:10 Shazib

I've tried setting it in the credentials object

msg.oauth2Request = { 
    "access_token_url": "https://accounts.google.com/o/oauth2/v2/auth",
    "credentials": {
        "grant_type": "authorization_code",
        "client_id": "<ID>",
        "client_secret": "<SECRET>",
        "scope": "https://www.googleapis.com/auth/tasks",
        "redirectUri": "https://nodered.example.com/oauth2/redirect",
        "redirect_uri": "https://nodered.example.com/oauth2/redirect",
    },
};
return msg
;

Shazib avatar Oct 08 '23 22:10 Shazib

According to this its just a get request. Is this project doing a POST? https://developers.google.com/identity/protocols/oauth2/javascript-implicit-flow

Shazib avatar Oct 08 '23 22:10 Shazib

Hello @Shazib,

Thank you for the information you provided. I am working to resolve this issue with Google authentication. I noticed that there's an extra confirmation screen that the node wasn't expecting, which led to this problem.

I am adjusting the authentication flow to handle this redirect properly. I hope to have this resolved soon. I appreciate your patience.

Best regards

caputomarcos avatar May 03 '24 02:05 caputomarcos

Hello @Shazib, I'd like to inform you that I've created a branch, and it's already functional. If you'd like to test it, here's the link. I'll be creating a release soon.

image

image

Best wishes.

caputomarcos avatar May 10 '24 15:05 caputomarcos

Hello @Shazib, I'd like to inform you that I've created a branch, and it's already functional. If you'd like to test it, here's the link.

I'll be creating a release soon.

image

image

Best wishes.

Thanks! I will check it out if I get time soon :)

Shazib avatar May 10 '24 15:05 Shazib