Node - Oauth2 API [GOT CREATED]

Solved. You gave me the idea with the offline access type, I had it in scope (which usually works) instead of the Query parameter. I can confirm the oAuth works for Office365 :slight_smile:

For reference:

2 Likes

Thanks a lot @sabatale! That is great to hear! I can then merge it soon into the master and release it with the next version.

1 Like

We are working on an implementation as well. Looking forward to that next version :+1:

Working with google API’s too great job !

1 Like

Hi @jan please can you help me with the implementation of Oauth2 into docker-compose running n8n ? I’ve already updated n8n image from docker hub to v. 0.60.0 but it seems to be not inside the image. I found the source code of the oauth plugin here https://github.com/n8n-io/n8n/tree/oauth-support but I am not sure, what specific should be copied to the docker container.

Thank you for your advice.

The problem is that it is still work in progress. Meaning it will probably still change. So if you start to use it now it will very likely break.

Yes I thought it. I just wanted to know what specific should be copied. If it’s like a custom created node or there are some other dependencies and I need to copy more files / directories instead of just “one node directory” and it start to work. Thanks.

Adding OAuth support to an existing n8n Docker image is not possible (OK is theoretically possible but would take incredible much work and would be a horrible mess). So what you would have to do is to build an own docker image.

How to do that @Talha_Khan described here (I never tested it):

If you have the “oauth-support” branch of n8n checked out you should be able to build an image like that which has then the current wip state.

Very happy to see OAuth is being worked on. It will make for a great addition to the already amazing product.

3 Likes

Any updates how it is going with oAuth2 support?

Sadly the only thing I can say is: very slow

1 Like

I have good news. I found more time the last week than expected. Also were some issues easier to fix than I thought they would. So I just pushed a beta version of n8n with OAuth2 support to docker: n8nio/n8n:0.67.2-oauth-beta

Please test and report back if you run into any issues. If possible, please also report if everything is working fine, as that is also very good to know. Thanks!

Please use n8nio/n8n:0.67.3-oauth-beta instead as it contains an important bugfix.

Hi! can’t find this branch

Hey @bundinho. Welcome to the community. This is the branch https://github.com/n8n-io/n8n/tree/oauth-support however, what you might want is the docker image here Docker Hub

1 Like

Was this merged into the 0.67.3 release? :crossed_fingers:

No that is a totally separate branch in GitHub. It includes everything in version 0.67.3 + the OAuth code and its integrations. The code of that branch got published as the above docker-image to allow people to test it before we merge it into master.
Currently are still waiting for feedback from the community to make sure everything is working fine. Before I do not receive it will hold on merging to avoid problems.

Using the image restarts my n8n container constantly with the following error:

>> docker logs -f n8n

The command "-c" is not known!

n8n Workflow Automation Tool

VERSION
  n8n/0.67.3 linux-x64 node-v12.16.1

USAGE
  $ n8n [COMMAND]

COMMANDS
  execute
  start    Starts n8n. Makes Web-UI available and starts active workflows

ln: /home/node/.n8n: File exists

The command "-c" is not known!

n8n Workflow Automation Tool

VERSION
  n8n/0.67.3 linux-x64 node-v12.16.1

USAGE
  $ n8n [COMMAND]

COMMANDS
  execute
  start    Starts n8n. Makes Web-UI available and starts active workflows

I use the docker-compose file from the repo:

n8n:
  image: n8nio/n8n:0.67.3-oauth-beta
  restart: always
  environment:
    - DB_TYPE=mongodb
    - DB_MONGODB_CONNECTION_URL=mongodb://${MONGO_NON_ROOT_USERNAME}:${MONGO_NON_ROOT_PASSWORD}@mongo:27017/${MONGO_INITDB_DATABASE}
    - N8N_BASIC_AUTH_ACTIVE=true
    - N8N_BASIC_AUTH_USER
    - N8N_BASIC_AUTH_PASSWORD
  ports:
    - 5678:5678
  links:
    - mongo
  volumes:
    - ~/.n8n:/root/.n8n
  command: /bin/sh -c "sleep 5; n8n start"

Ah yes that specific command did currently not work as the build/installation is done totally different.

So testing is possible just like with the regular image like this:

docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -v ~/.n8n:/root/.n8n \
  n8nio/n8n:0.67.3-oauth-beta \
  n8n start --tunnel

Additionally did I now improve the image that also executing with “/bin/sh” is possible. So for it to work the image has to get pulled again, to get the latest version with the fix:
docker pull n8nio/n8n:0.67.3-oauth-beta

And then does the line with the command in the docker-compose.yml has to get changed to this:

  command: /bin/sh -c "sleep 5; ./packages/cli/bin/n8n start"
1 Like

Some feedback:

  • callback url needs to be editable since internal docker url does not have to be the same as external (internet facing) url
  • disable connection test button before form was not saved

My test setup and the problems/config quirks: