AuthnWithPassword

Login with username and password for admin and test users.

rpc AuthnWithPassword

user_api.v1.AuthnWithPassword

Login with username and password for admin and test users.

requests AuthnWithPasswordRequest

user_api.v1.AuthnWithPasswordRequest

FieldTypeDescription
emailstringEmail address of the user.
passwordstringPassword of the user.
resp, _ := userApiService.AuthnWithPassword(ctx, &v1.AuthnWithPasswordRequest{
  Email: "[email protected]",
  Password: "PASSWORD",
})
fmt.Println(resp)
const authnwithpasswordrequest = new AuthnWithPasswordRequest();
authnwithpasswordrequest.setEmail("[email protected]");
authnwithpasswordrequest.setPassword("PASSWORD");

service.authnWithPassword(authnwithpasswordrequest, (err, value:AuthnWithPasswordResponse|null) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
using System;
using Grpc.Core;
using UserApi.V1;

namespace main
{
  class Program
  {
    static void Main(string[] args)
    {
      Channel channel = new Channel("user-mgmt.YOUR_SANDBOX_ID.knoxnetworks.io:443", ChannelCredentials.Insecure); 
      var client = new UserApiService.UserApiServiceClient(channel); 
      var headers = new Metadata();
      var authnWithPasswordRequest = new AuthnWithPasswordRequest{
        Email = "[email protected]",
        Password = "PASSWORD",
      };
      var reply = client.AuthnWithPassword(authnWithPasswordRequest, headers);
      Console.WriteLine("Response: " + reply);
      channel.ShutdownAsync().Wait();
    }
  }
}
package demo;

import io.grpc.Channel;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import user_api.v1.User.AuthnWithPasswordRequest;
import user_api.v1.User.AuthnWithPasswordResponse;
import user_api.v1.UserApiServiceGrpc;

public class App {
  public static void main(String[] args) {
    ManagedChannel channel = ManagedChannelBuilder
      .forAddress("user-mgmt.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
      .usePlaintext()
      .build();
    UserApiServiceGrpc.UserApiServiceBlockingStub blockStub =
        UserApiServiceGrpc.newBlockingStub(channel);
    
    AuthnWithPasswordRequest req_AuthnWithPasswordRequest =
        AuthnWithPasswordRequest.newBuilder()
          .setEmail("[email protected]")
          .setPassword("PASSWORD")
          .build();
    AuthnWithPasswordResponse resp = blockStub.authnWithPassword(req_AuthnWithPasswordRequest);
    System.out.println(resp);
    channel.shutdown();
  }
}
const authnwithpasswordrequest = new AuthnWithPasswordRequest();
authnwithpasswordrequest.setEmail("[email protected]");
authnwithpasswordrequest.setPassword("PASSWORD");

service.authnWithPassword(authnwithpasswordrequest, (err, value) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
extern crate grpc-sdks;
use tonic::transport::Channel;

use grpc-sdks::user_api::v1::user_api_service_client::UserApiServiceClient;
use grpc-sdks::user_api::v1::AuthnWithPasswordRequest;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
  let channel = Channel::from_static("user-mgmt.YOUR_SANDBOX_ID.knoxnetworks.io")
    .connect()
    .await?;
  let mut client = UserApiServiceClient::new(channel); 

  let request = tonic::Request::new(
    AuthnWithPasswordRequest{
      email: String::from("[email protected]"),
      password: String::from("PASSWORD")
    });
// sending request and waiting for response
  let response = client.authn_with_password(request).await?.into_inner();
  println!("RESPONSE={:?}", response);
  Ok(())
}
package app

import io.grpc.ManagedChannelBuilder
import user_api.v1.User.AuthnWithPasswordRequest
import user_api.v1.User.AuthnWithPasswordResponse
import user_api.v1.UserApiServiceGrpc

fun main() {
    val channel = ManagedChannelBuilder
            .forAddress("user-mgmt.YOUR_SANDBOX_ID.knoxnetworks.io", 443)
            .usePlaintext()
            .build()
    var blockStub = UserApiServiceGrpc.newBlockingStub(channel)
    
    val req_AuthnWithPasswordRequest = AuthnWithPasswordRequest.newBuilder()
          .setEmail("[email protected]")
          .setPassword("PASSWORD")
          .build()
    val resp = blockStub.authnWithPassword(req_AuthnWithPasswordRequest)
    println(resp)
    channel.shutdown()
}


returns AuthnWithPasswordResponse

user_api.v1.AuthnWithPasswordResponse

FieldTypeDescription
userUserUser object of the subject.
auth_tokenAuthTokenOAuth2 RFC6749 Access Token.
{
  "user": {
    "uuid": "UUID",
    "first_name": "John",
    "last_name": "Doe",
    "email": "[email protected]",
    "role": 0,
    "avatar": "AVATAR_URL",
    "phone": "+1 555 555 5555",
    "dids": [
      "did:method-name:zDIDMultibase58Encoded",
      "did:method-name:zDIDMultibase58Encoded"
    ],
    "external_ids": [
      {
        "key": "KEY1",
        "value": "VALUE1"
      },
      {
        "key": "KEY2",
        "value": "VALUE2"
      }
    ],
    "metadata": {
      "fields": []
    },
    "account": "15436675"
  },
  "auth_token": {
    "token": "TOKEN",
    "token_type": "TOKEN_TYPE",
    "expires_in": 100,
    "refresh_token": "REFRESH_TOKEN"
  }
}