Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jwillis07
Helper I
Helper I

Call API using Basic Auth + 2FA

Good afternoon all, looking to verfiy I've not done something wrong.


I'm trying to access the Pulseway RMM API that the documentation states: "uses Basic Authentication which requires an authorization header with the username and password in the username:password format encoded as Base64."

 

I've done this but I'm getting a "we couldn't authenticate with the credentials provided. Please try again." error message.

 

When I log in to Pulseway RMM web portal, my organisation requires 2FA in the form of using the Microsoft Authenticator app to generate a one-time 6-digit code - Am I right in thinking this is why I'm getting the failure to authenticate.

 

After looking around this forum, and the net as a whole, I found a post on this forum by @Anonymous that said:

y7nh5s7qq5b71.png

So I've tried updating my Base64 encoded credentials to be username:passcode:password but this doesn't work either. I've tried it using an external encoder like base64encode.org, and I've tried handling the encoding directly in Power Query.

 

Does anyone have any experience of calling an API that requires Basic Auth + 2FA?

 

My code:

 

 

let

    URL             =   "https://api.pulseway.com/",
    Path            =   "v2/systems",
    
    Username        =   "username",
    OneTimePasscode =   "123456",
    Password        =   "password",
    
        Credentials     =   Username & ":" & Passcode & ":" & Password,

            Binary = Text.ToBinary(Credentials),
            Base64 = Binary.ToText(Binary, BinaryEncoding.Base64),

    Source = Json.Document(Web.Contents(URL,
            
            [ RelativePath = Path, 
              Headers = [ Authorization = "Basic " & Base64 ]]))

in

    Source

 

1 REPLY 1
v-kelly-msft
Community Support
Community Support

Hi  @jwillis07 ,

 

You need to ask admin to first enable multi-factor authentication for you ,check the reference below:

https://dataap.org/blog/2017/05/11/multi-factor-authentication-for-power-bi-o365/

For basic auth,check below thread:

https://community.powerbi.com/t5/Desktop/Power-query-to-connect-REST-API-with-basic-authentication-i...

 

 

 

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors