how to make sure implicit OpenId implicit flow works In Couchbase Sync Gateway
Asked Answered
P

1

1

hi I am using identityserver4 in backend for getting jwt token inside of my app I want send my token to syncgateway and take a sessionid I read this article https://docs.couchbase.com/sync-gateway/current/authentication.html#implicit-flow and i am using OpenID Connect implisit flow but I have this response any time I sent POST http://localhost:4984/todo/_session by Athurazation Breare

{
    "error": "Unauthorized",
    "reason": "Invalid login"
}

my SG config is same this

{
  "log":["*"],
  "logging": { 
    "log_file_path": "c://var/tmp/sglogs",
    "console": {
      "log_level": "debug",
      "log_keys": ["*"]
    },
    "error": {
      "enabled": true,
      "rotation": {
        "max_size": 20,
        "max_age": 180
      }
    },
    "warn": {
      "enabled": true,
      "rotation": {
        "max_size": 20,
        "max_age": 90
      }
    },
    "info": {
        "enabled": true,
        "rotation": {
            "max_size": 100,
            "max_age": 6,
            "localtime": false
        }
    },
    "debug": {
        "enabled": false,
        "rotation": {
            "max_size": 100,
            "max_age": 2,
            "localtime": false
        }
    }
  },
  "adminInterface": "127.0.0.1:4985",
  "interface": "0.0.0.0:4984",
  "databases": {
    "todo": {
      "server": "http://127.0.0.1:8091",
      "username": "Administrator",
      "password": "@2588854424@",
      "bucket": "todo",
      "users":{ 
          "zkhahmadi": {"password": "123456", "admin_channels": ["*"]}
      },
      "roles": { 
        "Admin": {
          "admin_channels": [ "*" ]
        },
        "_TestAdmin": {
          "admin_channels": [ "*" ]
        }
      },
      "oidc": {
          "default_provider":"providertodo",
          "providers": {
            "providertodo": {
                "issuer":"https://staging.org/ids",
"validation_key":"MIIDNjCCAh6gAwIBAgIQT0Bt5EJjiNTYWoJeV/8yMzANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAlOZXBocm9haWQwHhcNMjAwODMwMDcxNzQyWhcNMjAwOTI5MDgxNzQyWjAbMRkwFwYDVQQDDBBbVEVTVF0gTmVwaHJvYWlkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvqz85sqnkhTJYDhw40Tp+7GKucgQ254IYyzX1II8JtwFm2q3iVIGLhZeewDOvPgZ/oQIJ7/D4husV7twK+WTTGfSoBOnfWPdFyozx826Y5M48/YeBXGRFhKwQbVgeF7On1Wr/o8Nrgk8GlpKlEN2Ir1T+RNoCcZcunOnouHma1BsYiYY3OQFpTQ0A3a+qD7TYnqJ5652dnNlLCSaJtGbfg7cGe7hjiCTEQKT/6nAZ5BznW59Gqldtrzm1cztydKYUDtfDGGJCvWwi2r1NwOXD6CuI6yti8PXwsxsWYVy7Em5o8oalq2BEa+5ljysvmCGSGmAya+vseOrCi53XaNfQIDAQABo30wezALBgNVHQ8EBAMCBPAwLAYDVR0lAQH/BCIwIAYIKwYBBQUHAwQGCCsGAQUFBwMCBgorBgEEAYI3CgMMMB0GA1UdDgQWBBTrOGbtwpB5vZJKMva9yaUE6SB2+jAfBgNVHSMEGDAWgBTznnnsIZL8ItV1yObizdwjnN08QTANBgkqhkiG9w0BAQsFAAOCAQEAWRprTDx696N8uS4yfKsIRhGJrgbKnfabhd+nsZq3v4nSXsNh39Whz3TwhiyzjDw9nk+IFyerHdPlW1G6IIx2GxqOcfSaega6tt4TzPBnX7AM7sEjmDN+z7gk3fvjCSoSlYwp2jgLypUX5LkdPQV4lLu+RWrOwBTP9Z2AuHAaF+K9heIncsPpG/jRnTQN/aO+hHGjE6WAyU+Kx8KP5Y+I2u9Srt9tRqCTAuXEsoiTgl4PivKowxl7xporMxYSh1pZFlkoJZsiHDkLvTAtEiie96w0yhbrP7Fi//GYUq0/wIzVBvn/ySX9qbKWuxFFv7bnpY0CRqmSXxmdIWoejQ==","register":true,"client_id":"native.code","callback_url":"http://localhost:4984/bucketname/_oidc_callback"}
          }
        },
    "sync": 
    `function(doc,oldDoc){
        if (doc.Status){
        channel("Done");
    } else {
        channel("Doing");  
    }
    }`
    ,
      "allow_conflicts": true,     
      "import_docs": true,
      "enable_shared_bucket_access":true,
      "num_index_replicas":0
    }
  }
  ,"CORS": {
        "Origin":["*"],
        "LoginOrigin":["*"],
        "Headers":["Content-Type"],
        "MaxAge": 1728000
    }
}

header my tokens is

{
  "alg": "RS256",
  "kid": "5279CF8BB69C2037B7C89299DE62D17C9738C6A7",
  "typ": "JWT",
  "x5t": "UnnPi7acIDe3yJKZ3mLRfJc4xqc"
}

and i can validate it successfully in https://jwt.io/#debugger-io

Peracid answered 30/8, 2020 at 8:56 Comment(0)
P
0

I sent access token and syncgateway don't work with it when I sent id token it act correctly and give me a sessionId

Peracid answered 4/9, 2020 at 18:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.