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

Notifications

Announcements

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

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
    on at

    @Chriddle, need your expert views on this.

  • Community Power Platform Member Profile Picture
    on at

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

  • Verified answer
    Chriddle Profile Picture
    8,443 Super User 2025 Season 2 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,443 Super User 2025 Season 2 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard