29
Views
7
Comments
[GoogleAPIToken] Object reference not set to an instance of an object
Question
Forge component by Miguel João
6
Published on 02 Jul 2019

Hi Team,


Not able get the token. Getting the error "Object reference not set to an instance of an object".


Regards,

Amreen Shaikh

Rank: #8101

Hi Outsystems community,

I am getting the same issue for one of my service accounts while it is working fine for another service account.

below is the error which I can see in the service center.

Object reference not set to an instance of an object.
at Org.BouncyCastle.Crypto.Signers.RsaDigestSigner.Init(Boolean forSigning, ICipherParameters parameters)
at OutSystems.NssGoogleAPIToken.CssGoogleAPIToken.GetRS256Signature(Byte[] ssContent, String ssPrivateKey)
at OutSystems.NssGoogleAPIToken.CssGoogleAPIToken.MssGetToken(RCClientRecord ssClient, Int32 ssTokenLifespan, String ssScope, RCTokenRecord& ssToken)
  at ssVMG_YO_DA.RssExtensionGoogleAPIToken.MssGetToken(HeContext heContext, IRecord inParamClient, Int32 inParamTokenLifespan, String inParamScope, IRecord& outParamToken)


Need quick help in understanding this 

Regards,

Jyotsna

Staff
Rank: #213

Hello,

What Platform version are you using with this component? Need to know which version I should test.

Thanks

Rank: #8101

Version 11.10.6

Staff
Rank: #213

Thanks.

That's the IDE version. I need the server version. Access the server with a Web Browser, and use the URL

https://<your-server-hostname-here>/ServiceCenter

Login, and check the version at the topright corner

Thanks

Rank: #8101
Rank: #8101
Staff
Rank: #213

Hello Jyotsna,

Yes, I was able to test it and it works as expected with that platform version. What I also found out is that the input parameter Client.PrivateKey in the GetToken action, needs to be set to a multiline string, and it doesn't support "\n" characters.

So, if you're inputting your private key  as a single line string like:

"-----BEGIN PRIVATE KEY-----\nMIIEvQ....\n-----END PRIVATE KEY-----\n"

That will generate the error message "Object reference not set to an instance of an object. "

In order to set the private key correctly, you'll need to set as a multiline code, by replacing the "\n" with actual new lines, like:

"-----BEGIN PRIVATE KEY-----

MIIEvQ....

-----END PRIVATE KEY-----"

Then it should work.

If you can't overcome the problem with this information, I ask you to provide a sample app with the input valures (test values) you're using to call the GetToken.

Thanks

Cheers