-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Json Key or Pem Key error #39
Comments
Hi,
As the comment says in the config, you will need to create a Service
Account and get a Google API Key in p12 format.
This should be the same Google account as which the Google calendars (for
each room) are created in. You can find more information
https://cloud.google.com/iam/docs/creating-managing-service-account-keys.
…On Thu, 8 Apr 2021, 3:46 am Nathan9745354, ***@***.***> wrote:
This is PEM error
listBookedEventsByRoom Error: Error: failed to obtain an authentication
token, request failed with HTTP code 400: invalid_grant
listEmptySlotsInDay Error: Error: failed to obtain an authentication
token, request failed with HTTP code 400: invalid_grant
Json Key error
listBookedEventsByRoom Error: Error: failed to sign JWT, the key is
probably invalid
listEmptySlotsInDay Error: Error: failed to sign JWT, the key is probably
invalid
Code here:
Settings.js
`//require the Google API Json Key
const KEYFILE = '../data/tghkbooking-xxxxxxxxx.pem';
const SERVICE_ACCT_ID = ***@***.***';
const CALENDAR_URL = '
https://calendar.google.com/calendar/embed?src=xxxxxxxxgmail.com&ctz=Asia%2FHong_Kong
';
const CALENDAR_ID={"primary": ***@***.******@***.***","ko":
***@***.******@***.******@***.******@***.***
***@***.******@***.******@***.***","qc":
***@***.******@***.******@***.******@***.***
***@***.******@***.******@***.***","zk":"
***@***.***"
};
const TIMEZONE = 'UTC+08:00';
module.exports.calendarUrl = CALENDAR_URL;
module.exports.serviceAcctId = SERVICE_ACCT_ID;
module.exports.calendarId = CALENDAR_ID;
module.exports.keyFile = KEYFILE;
module.exports.timezone = TIMEZONE;
//To use, require the module in your application and pass in the necessary
config file.
/
*const CONFIG = require('./config/settings.js'); const CalendarAPI =
require('node-google-calendar'); let cal = new CalendarAPI(CONFIG);*/
export { CONFIG as default, ROOM_CONFIG, SESSION_LENGTH,
BOOKING_DURATION_OPTIONS };
`
Please Help Thanks!!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#39>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA74UPBEOPIELQ45JO32Z6DTHSZBZANCNFSM42RNNXKA>
.
|
Hi Languantan, Yes, Settings.js module.exports.calendarUrl = CALENDAR_URL; //To use, require the module in your application and pass in the necessary config file. export { CONFIG as default, ROOM_CONFIG, SESSION_LENGTH, BOOKING_DURATION_OPTIONS };` .env |
This should be the same Google account as which the Google calendars (for what mean Google account as which the Google calendars (for I am using differ Google calendars account. I created a new gmail. For example: my google cloud account is [email protected] but in google calendar as using [email protected] for each room. |
Hmm I suspect your Google API key does not have access to your calendar.
Anyway you can confirm the API key has access?
…On Thu, 8 Apr 2021, 3:51 pm Nathan9745354, ***@***.***> wrote:
This should be the same Google account as which the Google calendars (for
each room) are created in. You can find more information
what mean Google account as which the Google calendars (for
each room)?
I am using differ Google calendars account. I created a new gmail.
For example: my google cloud account is ***@***.*** but in google
calendar as using ***@***.*** for each room.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#39 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA74UPDJ7VMTD5LIWB4YCBTTHVN6RANCNFSM42RNNXKA>
.
|
You mention the Google API Key is saying Json Key generated from service account? I'm not confirm the API Key has access right to Google Calendar. In Google Cloud has enable API Calendar . But how can I test the Json key can accessible? |
Do I need setting Oauth2.0 and create an application for API Key access Calendar? |
Update: I am using this URL to confirm. And I got this but it is not Json Key. |
any suggestions? Thanks |
This is PEM error
listBookedEventsByRoom Error: Error: failed to obtain an authentication token, request failed with HTTP code 400: invalid_grant
listEmptySlotsInDay Error: Error: failed to obtain an authentication token, request failed with HTTP code 400: invalid_grant
Json Key error
listBookedEventsByRoom Error: Error: failed to sign JWT, the key is probably invalid
listEmptySlotsInDay Error: Error: failed to sign JWT, the key is probably invalid
Code here:
Settings.js
//require
the Google API Json Keyconst KEYFILE = '../data/xxxxxx-xxxxxxxxx.pem';
const SERVICE_ACCT_ID = [email protected]';
const CALENDAR_URL = 'https://calendar.google.com/calendar/embed?src=xxxxxxxxgmail.com&ctz=Asia%2FHong_Kong';
const CALENDAR_ID={"primary": "[email protected]","th":"[email protected]","ko":[email protected]","kc":"[email protected]","hl":"[email protected]","ml":"[email protected]","fg":"[email protected]","q1":[email protected]","q2":"[email protected]","qc":[email protected]","dr":[email protected]","bb":"[email protected]","tt":"[email protected]","mc":"[email protected]","ak":"[email protected]","sk":"[email protected]","zk":"[email protected]"
};
const TIMEZONE = 'UTC+08:00';
module.exports.calendarUrl = CALENDAR_URL;
module.exports.serviceAcctId = SERVICE_ACCT_ID;
module.exports.calendarId = CALENDAR_ID;
module.exports.keyFile = KEYFILE;
module.exports.timezone = TIMEZONE;
//To use, require the module in your application and pass in the necessary config file.
/const CONFIG = require('./config/settings.js');
const CalendarAPI = require('node-google-calendar');
let cal = new CalendarAPI(CONFIG);/
export { CONFIG as default, ROOM_CONFIG, SESSION_LENGTH, BOOKING_DURATION_OPTIONS };
`
.env file:
TELEGRAM_BOT_TOKEN=xxxxxxxxxxxxxxxxxttl_xxxxxxxxxxxxxx [email protected] CALENDAR_ID={"primary": "[email protected]","th":"[email protected]","ko":[email protected]","kc":"[email protected]","hl":"[email protected]","ml":"[email protected]","fg":"[email protected]","q1":[email protected]","q2":"[email protected]","qc":[email protected]","dr":[email protected]","bb":"[email protected]","tt":"[email protected]","mc":"[email protected]","ak":"[email protected]","sk":"[email protected]","zk":"[email protected]" }; CALENDAR_URL=https://calendar.google.com/calendar/embed?src=xxxxx%40gmail.com&ctz=Asia%2FHong_Kong GOOGLE_KEYFILE_PATH=../data/xxxx-xxxx.pem
Please Help Thanks!!
The text was updated successfully, but these errors were encountered: