I'm trying to log into my Node-red instance using Nextcloud 14's new Oath2 implementation. I get through the login with nextcloud and get re-directed to the callback url
https://example.tld/node-red/auth/strategy/callback?state=&code=################################################################################################################################
but then I just get re-directed back to the node-red login screen
Nginx settings for node-red
#############
# Node-Red #
#############
location ^~ /node-red/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:1880/node-red/;
}
my settings.js based off the passport-oauth2 example
adminAuth: {
type:"strategy",
strategy: {
name: "oauth2",
label: 'Sign in with nextcloud',
icon:"fa-cloud",
strategy: require("passport-oauth2").Strategy,
options: {
authorizationURL: "https://example.tld/apps/oauth2/authorize",
tokenURL: "https://example.tld/apps/oauth2/api/v1/token",
clientID: "#####################################################################",
clientSecret: "#####################################################################",
callbackURL: "https://example.tld/node-red/auth/strategy/callback",
proxy: true
},
verify: function(accessToken, refreshToken, profile, done) {
done(null, profile);
}
},
users: [{
username: "dugite.code",
permissions: ["*"]
}]
},
Looking at this guy's gitlab login example it should all be possible:
https://www.claudiuscoenen.de/2018/10/oauth2-with-nextcloud-provider-and-gitlab-client/
There is a user information url available but passport didn't call for it.
"user_info_url" : "/ocs/v2.php/cloud/user?format=json"
I'm probably missing somethings simple