Nuxt auth does not make a request after receiving pkce_code_verifier #1592
Replies: 29 comments 2 replies
-
your redirectUri looks wrong - shouldn't it be localhost:8080 ? |
Beta Was this translation helpful? Give feedback.
-
No, the SSO server is on a different port |
Beta Was this translation helpful? Give feedback.
-
What about if you just set the endpoints.token property to be the url, not an object? All mine are just strings - this is what I am using to auth with a similar provider:
If you leave state out, it gets auto generated and is random. Also if you leave redirectUri out it defaults to PS: logout url has hhttp typo - not important for this convo but it'll annoy you later :-) |
Beta Was this translation helpful? Give feedback.
-
I tried to do everything without using the object, it was a typo after the trial, sorry that I did not correct it immediately. |
Beta Was this translation helpful? Give feedback.
-
OK one last thing I can think of - what package are you using? This capability is only in nuxtjs/auth-next, which will eventually replace nuxtjs/auth. |
Beta Was this translation helpful? Give feedback.
-
I use @nuxt/auth-next |
Beta Was this translation helpful? Give feedback.
-
OK well that's got me stumped! Do you have any errors in your browser console? Open it up and go through the entire login process and see if you get any errors, in particular the POST request after returning the auth |
Beta Was this translation helpful? Give feedback.
-
I was also puzzled by this behavior. There are no errors, the token request is not even sent |
Beta Was this translation helpful? Give feedback.
-
OK that's very strange - my suggestion is to use the demo application in this repo and add your strategy and an extra button to login. That's how I got my IBM AppID set up and testing. The demo includes a sample OAuth2 server as well but it uses implicit workflow - but it should at least give you something to chase down You've added the Auth middleware to your callback page, haven't you? |
Beta Was this translation helpful? Give feedback.
-
Yes I use middleware |
Beta Was this translation helpful? Give feedback.
-
And where can I clone a project with a demo |
Beta Was this translation helpful? Give feedback.
-
This repo - look in the demo directory |
Beta Was this translation helpful? Give feedback.
-
Hi @Icon003! Sorry for the delay. Do you still facing this issue? |
Beta Was this translation helpful? Give feedback.
-
Hello. I think i'm facing the same issue. Below are my current configuration : {
resetOnError: true,
localStorage: false,
redirect: {
login: "login",
logout: "logout",
callback: "/auth/", // <== trying to land here
home: "index"
},
cookie: { options: { sameSite: 'Lax' } },
strategies: {
my_super_oauth: {
scheme: 'oauth2',
endpoints: {
authorization: "https://my-oauth-server.com/oauth2/authorize",
token: "https://my-oauth-server.com/oauth2/token",
userInfo: "",
logout: ""
},
token: { property: 'access_token', type: 'Bearer', maxAge: 1800 },
refreshToken: { property: 'refresh_token', maxAge: 2592000 },
responseType: "code",
grantType: 'authorization_code',
accessType: 'offline',
clientId: "my_client_id",
codeChallengeMethod: 'S256',
scope: ['private'],
}
}
} What happen : I start logging the user in like so : this.$auth.loginWith('my_super_oauth')
.then((response) => console.log(response))
.catch((error) => console.log(error))
Then nothing. it sits there.. I'm using Auth module alongside i18n and more :
Not sure how but i fear i18n could interfere with any route interceptor (route local prefix ?) I can see i'm getting redirect from Does anyone has Oauth with |
Beta Was this translation helpful? Give feedback.
-
@JoaoPedroAS51 Hello, I have so far abandoned the idea of such authorization because of this problem, I think it is still relevant |
Beta Was this translation helpful? Give feedback.
-
@tiretdusix I don't use i18n and I have the same problem, so I guess it's not about it |
Beta Was this translation helpful? Give feedback.
-
I have this problem with IBM's PKCE and it turns out its authorization_code implementation is broken. Go through the sequence with your browser dev console open and have a look at what's being sent and received - that's how I found out it was IBM's implementation and not nuxt/auth. What I found was that it went through the same as you and nuxt/auth was then POSTing the code back as it is meant to, but the POST call was broken and was returning an error. |
Beta Was this translation helpful? Give feedback.
-
Hello @davydnorris Once i'm back on my callback URL with the code in query parameters, nothing happens. |
Beta Was this translation helpful? Give feedback.
-
That sounds like the middleware isn't catching the response - do you have it enabled on your pages? |
Beta Was this translation helpful? Give feedback.
-
Hello. Auth middleware is globally enable in nuxt configuration at :
I've been running the website using JWT locale strategy so far. |
Beta Was this translation helpful? Give feedback.
-
I have all the same as at @tiretdusix, there is no request |
Beta Was this translation helpful? Give feedback.
-
Also facing the same issue.
Fixed mine by making sure you include
|
Beta Was this translation helpful? Give feedback.
-
I fought with this same problem for a while, in the end for me what fixed it was missing the redirect object inside the auth.
|
Beta Was this translation helpful? Give feedback.
-
@ETS-Nathaniel you save my day) |
Beta Was this translation helpful? Give feedback.
-
Hi, tried forcing it with this.$auth.strategy.token.get() but I get a CORS error. Any help would be appreciated. |
Beta Was this translation helpful? Give feedback.
-
@Singularity-2021 - found there were two problems:
|
Beta Was this translation helpful? Give feedback.
-
Just to add we never got this to work with auth-next@5.0.0-1637745161 either, the redirect URL with code and state params just never calls the token URL (or any other). Of the above suggestions neither changing the order of module imports nor adding the redirects in the auth config helped. |
Beta Was this translation helpful? Give feedback.
-
After days of searching and investigating I finally got it working. Here are my findings:
But you want to redirect to home page after login? => Yes, is still redirect to your home page after login because the default value of auth.redirect.home is '/'
|
Beta Was this translation helpful? Give feedback.
-
I'm stuck with this as well. I have the exact same problem when it'll not handle the code challenge, and just hangs at that point.
My sign in page is this:
I've attempted everything in this discussion, and had no change. So I'm almost to the point of rolling my own based off another plugin I created a while ago for quasar. |
Beta Was this translation helpful? Give feedback.
-
Hello, I have a problem when using @ nuxt / auth, I use it to interact with keycloak openID, with my settings. After I have passed the authorization, I am thrown to my page with pkce_code_verifier, but auth does not make a request to get tokens, if I do it manually with this code, then I will get tokens. What am I doing wrong, please tell me
Beta Was this translation helpful? Give feedback.
All reactions