Skip to content

JWT Client throws PEM_read_bio:no start line #418

@justinmanley

Description

@justinmanley

I'm trying to authenticate to the Fusion Tables API using the JWT client. I generated a .p12 file from developers.google.com, and followed the instructions here. Whenever I try to authenticate, I get the following: [Error: error:0906D06C:PEM routines:PEM_read_bio:no start line].

I've trimmed the code down to a minimal example:

#!/usr/bin/env node

var cwd = process.cwd(),
    google = require('googleapis');

var jwtClient = new google.auth.JWT(
    'email@developer.gserviceaccount.com',
    null,
    cwd + '/key.pem',
    ['https://www.googleapis.com/auth/fusiontables'],
    'myemail@gmail.com'
);

jwtClient.authorize(function(authErr) {
    if (authErr) { throw authErr; }
});

I've checked - the path above is correct, and the contents of the .pem file are:

Bag Attributes
    friendlyName: privatekey
    localKeyID: redacted
Key Attributes: <No Attributes>
-----BEGIN PRIVATE KEY-----
redacted
-----END PRIVATE KEY-----

I thought this issue might have to do with an encoding issue, and I looked through some of the auth-token dependencies of this library - but adding { encoding: 'utf8' } to calls to fs.readFile didn't fix the issue.

Any idea what might be causing this?

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.triage meI really want to be triaged.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions