Forum Discussion

IdrissBenbassou's avatar
IdrissBenbassou
New Member
3 years ago

fetching data from an optional field (custom connector)

Hello, I'm developing a custom connector for power Bi and i have a problem when fetching data from an optional field in dataSourcePath 

 

This is a sample of the code for the authentication 

 

 

 

StartLogin = (dataSourcePath, state, display) =>
let
    url = Json.Document(dataSourcePath)[url],
    clientId =  if(Json.Document(dataSourcePath)[client_id]=null) then "default_dc" else Json.Document(dataSourcePath)[client_id],
    codeVerifier = Text.NewGuid() & Text.NewGuid(),
    codeChallenge = "",
    AuthorizeUrl = url & Uri.BuildQueryString([
		client_id = clientId,
		response_type = "code",
		code_challenge_method = "S256",
		code_challenge = codeChallenge,
		state = state,
		scope = "profile openid",
		redirect_uri = redirect_uri])
in
	[
		LoginUri = AuthorizeUrl,
		CallbackUri = redirect_uri,
		WindowHeight = 600,
		WindowWidth = 450,
		Context = [
                   codeVerifier = codeVerifier,
                   uri = url,
                   client_id = clientId
                ]
	];

 

 


When the field client_id is mandatory then the value is fetched correctly but when i set the field to be an optionnal then the value Json.Document(dataSourcePath)[client_id]) is null whatever we put the value of the field

 

It's looks like a bug in powerbi connector when using pkce auth, can you please tell me if there is any solution to fix that ?

 

thanks