Skip to content
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

Unable to find testenv file into current project in visual studio code #93

Open
Rajshah1897 opened this issue Sep 16, 2020 · 28 comments
Open

Comments

@Rajshah1897
Copy link

ISSUER=https://yourOktaDomain.com/oauth2/default
SPA_CLIENT_ID=123xxxxx123

In which file we need to add the above field? not understand testenv

@mraible
Copy link
Contributor

mraible commented Sep 16, 2020

If you clone this repository, you should create a testenv file (that's it, no extension) in the root directory of the cloned repo.

@Rajshah1897
Copy link
Author

Rajshah1897 commented Sep 16, 2020

I changed it here.

is that ok? Please see that image as below. where is the root directory in this pic? Do I need to create testenv file inside the resource server?

image

@mraible
Copy link
Contributor

mraible commented Sep 16, 2020

The testenv file should be in the same directory as config.js.

@Rajshah1897
Copy link
Author

Ok Do I need to update anything in config.js?

@mraible
Copy link
Contributor

mraible commented Sep 16, 2020

No. It should read your values and override what's configured in there.

@Rajshah1897
Copy link
Author

Ok Do I need to setup testenv should be testenv.js? like that?

@mraible
Copy link
Contributor

mraible commented Sep 16, 2020

No, it should just be named testenv. It should not have a .js extension.

@Rajshah1897
Copy link
Author

Ok

@Rajshah1897
Copy link
Author

Rajshah1897 commented Sep 16, 2020

Now what is the next step after this? I can not see any front end samples in your prerequisite

image

@mraible
Copy link
Contributor

mraible commented Sep 16, 2020

@Rajshah1897
Copy link
Author

Ok I got the error as below.

Error: Cannot find module 'dotenv'
Require stack:

  • /Users/shahr/Downloads/samples-js-angular-master/scripts/startResourceServer.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object. (/Users/shahr/Downloads/samples-js-angular-master/scripts/startResourceServer.js:6:16)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/Users/shahr/Downloads/samples-js-angular-master/scripts/startResourceServer.js'
    ]
    }
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! @okta/[email protected] resource-server: node scripts/startResourceServer.js
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the @okta/[email protected] resource-server script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/shahr/.npm/_logs/2020-09-16T19_50_59_123Z-debug.log
shahr@US3RAPM0CD1EYMD samples-js-angular-master %

@Rajshah1897
Copy link
Author

@mraible can you please share the screenshots? how it looks like in UI? and what I am missing here? there is not enough information or may be I am missing something.

@mraible
Copy link
Contributor

mraible commented Sep 16, 2020

You need to run npm install first.

@Rajshah1897
Copy link
Author

Ok run npm install and it is successfully run now but how to connect front end samples and what is the front end file name? and how to run both in terminal?

image

@mraible
Copy link
Contributor

mraible commented Sep 17, 2020 via email

@Rajshah1897
Copy link
Author

Ok I did it and it was successfully run but when I checked localhost:8080 I got 400. Here is there screenshots as below.

Pease check testenv file are good?

1- customer-login

image

2.resource-server

image

Browser output

image

@mraible
Copy link
Contributor

mraible commented Sep 17, 2020 via email

@Rajshah1897
Copy link
Author

Rajshah1897 commented Sep 17, 2020

No same thing I used that URI http://localhost:8080 after login my okta account it is showing me 400 error.
Please find as below screenshots and also check the testenv file. should I need to create testenv file into both? resource-server and custom-login folder? and both should be same?

image

image

system log
image

@mraible
Copy link
Contributor

mraible commented Sep 17, 2020 via email

@Rajshah1897
Copy link
Author

Also let me know testenv files are ok or not for both folder? Is it same for both?

@mraible
Copy link
Contributor

mraible commented Sep 17, 2020 via email

@Rajshah1897
Copy link
Author

The error as below after hitting this URL

image

image

Also I am not understanding where I need to use this Issuer and client id and which file? because right now I just removed the testenv file from my current folder and there is no change if I am adding this or not adding this. Please write the all steps and how to config in resource-server and custom-login. it is kind of confusing.

**These values must exist as environment variables. They can be exported in the shell, or saved in a file named testenv, at the root of this repository. (This is the parent directory, relative to this README) See dotenv for more details on this file format.

ISSUER=https://yourOktaDomain.com/oauth2/default
CLIENT_ID=123xxxxx123**

@mraible
Copy link
Contributor

mraible commented Sep 17, 2020 via email

@Rajshah1897
Copy link
Author

Yes it is working fine as below. Please confirm.

Also I have a questions about testenv that is still I am not getting I did not use that file in my current repository so how they will take my profile? did you do something at your end? and how?

Please find the screenshots as below.

image

image

No testenv in my repository
image

@mraible
Copy link
Contributor

mraible commented Sep 17, 2020

The testenv file is in the custom-login's parent directory and the webpack configuration is smart enough to look there. If you didn't have this file there, it wouldn't work.

@Rajshah1897
Copy link
Author

Also I need to know how the same application work to generate the token? like machine to machine? Here we are tested with SPA. but I need to know machine to machine.

@mraible
Copy link
Contributor

mraible commented Sep 17, 2020

Please see Secure Server-to-Server Communication with Spring Boot and OAuth 2.0 for server-to-server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants