web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / DecodeBase64 is Not Wo...
Power Automate
Answered

DecodeBase64 is Not Working For Me

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

I am trying to build a flow that converts a Bearer token into a string I'm using the decodeBase64 method, but my Flows continue to fail at the step decodebase64 below is an error.

 

but the base64 string is get decoded on https://www.base64decode.org

 

Unable to process template language expressions in action 'Compose_3' inputs at line '0' and column '0': 'The template language function 'decodeBase64' was invoked with a parameter that is not valid. The value cannot be decoded from base64 representation.

saurabhTripahti_0-1676438200145.png

 

saurabhTripahti_1-1676438271582.png

 

 

Base64string is:

eyJpYXQiOjE2NzY0MzMyMTMsInZlciI6IlNUSS5FeHRlcm5hbEFjY2Vzc1Rva2VuLlYxIiwiYXBwaWQiOiI0OGFmMDhkYy1mNmQyLTQzNWYtYjJhNy0wNjlhYmQ5OWMwODYiLCJzdWIiOiJTYXVyYWJoLlRyaXBhdGhpQGhhdmVsbHMuY29tIiwiYXBwaWRhY3IiOiIyIiwiYWNyIjoiMCIsInRpZCI6IjdiN2RjMmY1LTRlNmEtNDAwNC05NmRkLTZjNzkyMzYyNWIyNSIsInNlbmRlciI6IlNhdXJhYmguVHJpcGF0aGlAaGF2ZWxscy5jb20iLCJvaWQiOiI4OTE2YjY1Zi00YTAzLTRmZmItOGFiNC0xNDdhOWViODc5NGYiLCJuYmYiOjE2NzY0MzMyMTMsImV4cCI6MTY3NjQzNDExMywiaXNzIjoiaHR0cHM6Ly9zdWJzdHJhdGUub2ZmaWNlLmNvbS9zdHMvIiwiYXVkIjoiaHR0cHM6Ly9wcm9kLTAzLmNlbnRyYWxpbmRpYS5sb2dpYy5henVyZS5jb20ifQ

The concerned section of my flow looks like this:

 

Is there something wrong with my syntax? 

 

please help!!

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @Chriddle, need your expert views on this.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @v-yuazh-msftneed your expert views on this.

  • Verified answer
    Chriddle Profile Picture
    8,672 Super User 2026 Season 1 on at

    Your base64 string is missing the padding (character[s] "=" added to make the last encoded block contain 4 characters)

    Try this to add them (assuming your encoded string is in "Compose"):

     

     

     

     

    decodeBase64(
    	if(
    		equals(
    			mod(length(outputs('Compose')), 4),
    			1
    		),
    		concat(
    			outputs('Compose'),
    			'==='
    		),
    		if(
    			equals(
    				mod(length(outputs('Compose')), 4),
    				2
    			),
    			concat(
    				outputs('Compose'),
    				'=='
    			),
    			if(
    				equals(
    					mod(length(outputs('Compose')), 4),
    					3
    				),
    				concat(
    					outputs('Compose'),
    					'='
    				),
    				outputs('Compose')
    			)
    		)
    	)
    )

     

     

     

     

  • Chriddle Profile Picture
    8,672 Super User 2026 Season 1 on at

    The test for (mod 4 == 1) is superfluous, this cannot happen.

  • KurtisRC Profile Picture
    21 on at

    Thank you, I've been trying to work this out for 48 hours. 
    You are amazing, thank you sooooo much.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 589

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 284 Super User 2026 Season 1

Last 30 days Overall leaderboard