# Issues with oAuth2

**URL:** <https://discourse.nodered.org/t/issues-with-oauth2/49394>\
**Category:** General\
**Created:** [5 August 2021 19:02 UTC](https://discourse.nodered.org/t/issues-with-oauth2/49394 "2021-08-05T19:02:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nacartwright](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/nacartwright/32/41906_2.png) [@nacartwright](https://discourse.nodered.org/u/nacartwright)\
**Post date:** [5 August 2021 19:02 UTC](https://discourse.nodered.org/t/issues-with-oauth2/49394/1 "2021-08-05T19:02:01Z")

</div>

**Environment**

- Container running on Google Cloud Run
- MongoDB Storage (node-red-mongo-storage-plugin)
- AdminAuth with passport-google-oauth20

I have two issues and I believe that they're related.

\*\* Issue 1 \*\*  
When I login with passport everything is fine but randomly it seems the session expires. For instance I can click on "Deploy" and sometimes an error saying not authorized to deploy.

\*\* Issue 2 \*\*  
I'm using node-red-contrib-google-calendar for calendar integration with relies on oAuth2. However, it seems like when my first issue happens my Google Calendar nodes are no longer able to access the credentials. I have to delete the credentials and then readd them to be able to access the calendar again.

Here is my adminAuth config:

```auto
adminAuth: {
	type: "strategy",
	strategy: {
	  name: "google",
	  label: 'Sign in with Google',
	  icon: "fa-google",
	  strategy: require('passport-google-oauth20').Strategy,
	  options: {
		response_type: "code",
		project_id: "REDACTED",
		prompt: "consent",
		auth_uri: "https://accounts.google.com/o/oauth2/auth",
		token_uri: "https://www.googleapis.com/oauth2/v3/token",
		auth_provider_x509_cert_url: "https://www.googleapis.com/oauth2/v1/certs",
		clientID: 'REDACTED',
		clientSecret: 'REDACTED',
		scope: 'email',
		callbackURL: "https://REDACTED.intelligentcx.io/admin/auth/strategy/callback",
		accessType: 'offline',
		token_uri: "https://www.googleapis.com/oauth2/v3/token",
		auth_provider_x509_cert_url: "https://www.googleapis.com/oauth2/v1/certs",
		redirect_uris: "https://REDACTED.intelligentcx.io/admin/auth/strategy/callback", 
		javascript_origins: "https://REDACTED.intelligentcx.io",
		client_secret: "REDACTED",
	  },
		verify: function(token, tokenSecret, profile, done) {
			profile.username = profile.emails.find(x => x.verified).value;
			done(null, profile);
		 }
	},
	users: function (username) {
	  return Promise.resolve({
		username: username,
		permissions: "*"
	  });
	}
  },

```

Not quite sure what's goin on here.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 October 2021 19:02 UTC](https://discourse.nodered.org/t/issues-with-oauth2/49394/2 "2021-10-04T19:02:20Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
