microsoft / code-push-server

Standalone CodePush server from App Center
MIT License
605 stars 157 forks source link

How to solve this issue of The session or access key being used is invalid, please run "code-push-standalone login" again. #10

Open Gautham495 opened 1 month ago

Gautham495 commented 1 month ago
Screenshot 2024-10-05 at 8 13 48 PM

I have done all the things mentioned in the readme and i am stuck here. Please solve this.

cleberhensel commented 1 month ago

I had the same problem. In my case, it was because I was running the application incorrectly.

I started running something like:

yarn clean && yarn build && yarn start:env

But you need to have filled in 1 set of keys either GitHub Or Microsoft in ./api/.env

GITHUB_CLIENT_ID GITHUB_CLIENT_SECRET MICROSOFT_CLIENT_ID MICROSOFT_CLIENT_SECRET

icarusdust commented 1 month ago

I was having the same issue, I stopped and restarted the server, it helped but not completely. Now, I am getting the same error in the server logs. Here are the steps that I followed:

  1. I have .env in ./api with GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET set. SERVER_URL is pointing to http://localhost:3000
  2. While server is up and running, I run code-push-standalone login which opens a browser to authenticate, when I am clicking on Github, or Microsoft, it redirects to authorize the action, then it throws Internal Sever Error. Upon checking the logs, it says Error: connect ECONNREFUSED 127.0.0.1:10002. I added HTTP_PROXY in .env to fix it, then the error cahnged to the same message mentioned in the original question.
Jeyoung-Park commented 1 month ago

@icarusdust i am using azurite by visual studio code. port 10002 was used by azurite:table port by defaultm so i changed to 10003 and then it worked.

image

icarusdust commented 1 month ago

@Jeyoung-Park thanks, I have already updated it to 10003 and synced it but still throwing the same error. Wondering if you configured anything specifically inside .env

Jeyoung-Park commented 1 month ago

@Jeyoung-Park thanks, I have already updated it to 10003 and synced it but still throwing the same error. Wondering if you configured anything specifically inside .env

@icarusdust

i just used GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET I didn't use MICROSOFT_CLIENT_ID and MICROSOFT_CLIENT_SECRET

imanshul commented 1 month ago

I'm also facing the same issue, any solution?

Error on page at http://localhost:3000/auth/callback/github?code=someValue&state=someValue

Internal Server Error

Error in logs:

Error: connect ECONNREFUSED 127.0.0.1:10002

My .env has following values:

EMULATED=true SERVER_URL=http://localhost:3000 GITHUB_CLIENT_ID=someValue GITHUB_CLIENT_SECRET=someValue LOGGING=true

imanshul commented 1 month ago

I'm able to resolve the Error: connect ECONNREFUSED 127.0.0.1:10002 issue by installing azurite and running the server locally.

Just modify .env to have below config, which is default for Azurite (emulator for local)

AZURE_STORAGE_ACCOUNT=devstoreaccount1 AZURE_STORAGE_ACCESS_KEY=Eby8vdM02xNOcqFEY3PL4kAzqT0qY5cV

batuhanbag commented 1 month ago

you need to add these credentials GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET your .env file for authentication and after that app will redirect to github

amir-ben-shimol commented 1 month ago

Make sure to add the SERVER_URL configuration under your .env file.

_SERVER_URL: The URL of your server, for local deployment it will be either http://localhost:3000 or https://localhost:8443. For Azure it will be your Azure App URL_

houjinyun commented 1 month ago

I'm also facing the same issue, any solution?

Error on page at http://localhost:3000/auth/callback/github?code=someValue&state=someValue

Internal Server Error

Error in logs:

Error: connect ECONNREFUSED 127.0.0.1:10002

My .env has following values:

EMULATED=true SERVER_URL=http://localhost:3000 GITHUB_CLIENT_ID=someValue GITHUB_CLIENT_SECRET=someValue LOGGING=true

This solve my same problem.

ahsanparacha02 commented 4 weeks ago

I'm also facing the same issue, any solution? Error on page at http://localhost:3000/auth/callback/github?code=someValue&state=someValue

Internal Server Error

Error in logs:

Error: connect ECONNREFUSED 127.0.0.1:10002

My .env has following values: EMULATED=true SERVER_URL=http://localhost:3000 GITHUB_CLIENT_ID=someValue GITHUB_CLIENT_SECRET=someValue LOGGING=true

This solve my same problem.

I am getting same error with github login as mentioned .env configuration.

Image

iiifinal commented 4 weeks ago

Try to clear the data of azurite. Then re-initialize and run azurite. Then change const devConnectionString = "UseDevelopmentStorage=true"; to a full connection string. And do not use the default storage account. And set the value of the storage account in the environment variable configuration file .env or .test.env. Example: const devConnectionString = "DefaultEndpointsProtocol=http;AccountName=alice;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1: 10000/alice;QueueEndpoint=http://127.0.0.1:10001/alice;TableEndpoint=http://127.0.0.1:10002/alice;";

amiinous commented 2 weeks ago

I had the same issue and managed to fix it by installing the Azurite via terminal (instead of previously VSCode) by npm install -g azurite. Then runnning the command azurite (without the any flag like --silent or --location) to fire up the service.

mustafauyysl commented 1 week ago

You must to add Bearer token to your requests.

Example:

curl --location 'http://localhost:3000/apps' \ --header 'Authorization: Bearer YOUR BEARER TOKEN'

You can take your bearer token after register(localhost:3000/auth/register) in chrome.

kaushil111 commented 4 days ago

I had DEBUG_DISABLE_AUTH=true and DEBUG_USER_ID=1234567890, removing those allowed me to register.