Getting a Session Expired (401) Error in Ionic CLI for ionic upload command


#1

I tried uploading new changes to an existing ionic 2 app and keep gettin the following message:

c:\Magaza>ionic upload
WARN: No ‘upload:before’ gulp task found!
If your app requires a build step, you may want to ensure it runs before upload.

Uploading app…
An error occurred uploading the build: Session expired (401). Please log in and run this command again.

Session expired (401). Please log in and run this command again. (CLI v2.0.0-beta.37)

Your system information:

Cordova CLI: 5.3.1
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.1
Ionic Framework Version: 2.0.0-beta.11
Ionic CLI Version: 2.0.0-beta.37
Ionic App Lib Version: 2.0.0-beta.20
OS: Windows 8.1
Node Version: v0.12.7

Before now I’ve had no issues uploading. I’ve tried logging in via the browser but no dice. Is there a way to force a login from the CLI or otherwise? I’ve checked online and this situation doesn’t seem to be that common.

Thanks in advance!


#2

I had the same issue.

I ran the command “ionic login” in the terminal/command line and logged in.

That worked for me.


#3

That sounds embarrassingly simple :sweat_smile:. I could blame the lack of Zzzzzzzz
for missing that, But thanks for taking the effort to answer.


#4

I don’t think it was your lack of Zzzzzzzz’s. I’ve been using Ionic for months now and never had this issue. Usually the “ionic upload” would just prompt for the username and password when my session had expired. I did an “ionic --help” and did not see the “ionic login” (maybe I am blind, looked there again and still do not see it). I found the “–email” and “–password” parameters for the “ionic upload” and assumed that would be the answer. It still failed with the 401. So I tried the “ionic login” and life is good now—yep, it is simple when you know the command exists :-). Thanks for your question @semoju and the assist from @SereneSounds.


#5

Thanks. You’re right. Its not listed in the ionic command list when you run the CLI for help. Thanks for the context.


#6

I propose a PR to fix this : https://github.com/driftyco/ionic-cli/pull/1317

Some tests have failed, i don’t understand why, so i’m waiting :slight_smile:


#7

Wow! This just saved my bacon. I recently changed the password to my ionic account and came across this issue just now.