access_type missing for OIDC/OAuth. Token expires after one hour.
See original GitHub issueHi
I’m using the oidc auth module to authenticate against Google. My actual problem is, that after an hour I have to re-authenticate against Google. I’ve read that Google has to be called with the access_type=offline to get a refresh_token. But I haven’t found any possibility to add this to the configuration. I also investigated on the request in the Chrome dev tools and this param is missing.
In addition I don’t use Redis. But I only run a single node k3s cluster with just one instance of Traefik v2 and external-auth-server. I guess in this case Redis is optional.
I use the following configuration, just to check whether all the other stuff is correct:
let config_token = {
aud: "mydomain.io",
eas: {
plugins: [{
type: "oidc",
issuer: {
discover_url: "https://accounts.google.com/.well-known/openid-configuration",
},
client: {
client_id: "myid.apps.googleusercontent.com",
client_secret: "mysecret"
},
scopes: ["openid", "email", "profile"], // must include openid
redirect_uri: "https://auth.domain.io/oauth/callback",
features: {
cookie_expiry: true,
userinfo_expiry: true,
session_expiry: true,
session_expiry_refresh_window: 60 * 30, // Google's access_token expires within 60min
session_retain_id: true,
refresh_access_token: true,
fetch_userinfo: true,
introspect_access_token: false, // Not supported by Google
authorization_token: "access_token"
},
assertions: {
exp: true,
nbf: true,
iss: true,
userinfo: [ {
query_engine: "jp",
query: "$.email",
rule: {
method: "in",
value: ["myemailr@gmail.com"],
case_insensitive: false
}
} ]
},
cookie: {
domain: "mydomain.io",
},
headers: {},
}]
}
};
Google’s access_token has a validity of 60 minutes.
Thank you. Best Danny
Issue Analytics
- State:
- Created 4 years ago
- Comments:26 (15 by maintainers)
Top Results From Across the Web
Not getting refresh token even though access_type is offline in ...
The oauth2 server will only ever mint one refresh token at a time, ... Oauth2 refresh token expires in 1 hour - is...
Read more >Not receiving Google OAuth refresh token - Stack Overflow
The access token expires soon after you receive it and you will need to refresh it. You correctly made the request to get...
Read more >Access Token Lifetime - OAuth 2.0 Simplified
Typically services using this method will issue access tokens that last anywhere from several hours to a couple weeks. When the service issues ......
Read more >OpenID Connect & OAuth 2.0 API - Okta Developer
Okta rejects JWTs that expire more than one hour in the future. Okta rejects the JWT if the jti claim is present and...
Read more >Continuous access evaluation in Azure AD - Microsoft Entra
Token expiration and refresh are a standard mechanism in the industry. ... access tokens are valid for one hour, when they expire the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thank you, the request to google now inculdes the
access_type=offlineparameter. Is there a simple method to check whethereascan retrieve and use it? Because this part is hidden from the browser. According to google,eashas to retrieve therefresh_tokenfrom the token endpoint, together with the other tokens (id_tokenandaccess_token).I will give you feedback from a front-end perspective whether I have to re-authenticate after an hour or not 😉
This has landed in master/latest.