Forum Discussion

clongaw's avatar
clongaw
Frequent Visitor
3 years ago
Solved

"Object Reference not set to instance" error in Custom Connector Power BI OAuth FinishLogin

I'm trying to build a Custom Connector in Power BI and am running into an issue in the beginning of the OAuth flow. I'm able to successfully open the window for the user to log in, and successfully f...
  • clongaw's avatar
    3 years ago

    There were a few issues in the code regarding the API, but the largest one that was causing the unknown error was that the LoginUri field in StartLogin wasn't being populated correctly for some reason. By switching to explicitly stating the LoginUri, the OAuth flow is allowed to continue. 

    StartLogin = (resourceUrl, state, display) =>
        let
            authorizeUrl = "https://authorizeUrl/OAuth/Authorize?client_id=PowerBI&state=" & state & "&redirect_uri=https://oauth.powerbi.com/views/oauthredirect.html"
        in
            [
                LoginUri = "https://authorizeUrl/OAuth/Authorize?client_id=PowerBI&state=" & state & "&redirect_uri=https://oauth.powerbi.com/views/oauthredirect.html",
                CallbackUri = "https://oauth.powerbi.com/views/oauthredirect.html",
                WindowHeight = 800,
                WindowWidth = 700,
                Context = null
            ];