okta / samples-golang

samples-golang
https://github.com/okta/samples-golang
Apache License 2.0
78 stars 35 forks source link

"The code was not returned or is not accessible" #43

Open whod81 opened 3 years ago

whod81 commented 3 years ago

I've tried running this on a couple different platforms and I have gotten the same error message, "The code was not returned or is not accessible"

It looks like there should be a get query on the callback and I'm not getting one? I am not sure.

The URL at the end: http://localhost:8080/authorization-code/callback?state=ApplicationState&error=invalid_request&error_description=The+authorization+server+id+is+invalid.

bretterer commented 3 years ago

Hello @whod81. Can you tell me which one of the samples you are using. It appears you may be using the custom-login?

If this is the case, please share your config (minus any keys) that you are using for the sign in widget initialization. Could you also please provide some reproduction steps that you are using to help us debug.

whod81 commented 3 years ago

i am using the golang okta-hosted-login

Login redirect URI is configured in Okta like this:

http://localhost:8080/authorization-code/callback

.env file is this:

CLIENT_ID=xXXXXXXXXXXXx CLIENT_SECRET=xxXXXXXXXXXXXXXXXX ISSUER=https://mycompanynametest.okta.com/oauth2/default

To reproduce I simply "go run main.go" go to localhost:8080 in browser and click Login button

mraible commented 3 years ago

If you log in to your Okta org and go to Security > API, do you see a "default" server listed there? If not, you probably don't have API access management as a feature. If you create a new developer account at developer.okta.com/signup, you can get it for free.

whod81 commented 3 years ago

@mraible that is indeed the case. I was unaware I needed that to authenticate with OIDC.

Is this specific to the GoLang implementation? My OIDC authentication is working okay with other tools in this environment. (For instance I put this same application configuration on an AWS Load Balancer and it worked properly).

ghost commented 1 year ago

Running into the same issue here despite having a default server listed under API. Also using the golang sample.

The error description is User is not assigned to the client application. however the docs state that If you are currently using your Developer Console, you already have a Single Sign-On (SSO) session for your Org. You will be automatically logged into your application as the same user that is using the Developer Console here

What does it mean to assign a user to the client application? Is that something I can do in the dev console?

ghost commented 1 year ago

Running into the same issue here despite having a default server listed under API. Also using the golang sample.

The error description is User is not assigned to the client application. however the docs state that If you are currently using your Developer Console, you already have a Single Sign-On (SSO) session for your Org. You will be automatically logged into your application as the same user that is using the Developer Console here

What does it mean to assign a user to the client application? Is that something I can do in the dev console?

Got the solution from this issue. Under applications, you can click the gear icon for your app of choice and then assign to users or groups. I assigned to everyone for my use case.