本文的目的是介绍MongoDB:期望:连接失败,退出,代码为1的详细情况,特别关注mongodb连接超时的相关信息。我们将通过专业的研究、有关数据的分析等多种方式,为您呈现一个全面的了解MongoDB
本文的目的是介绍MongoDB:期望:连接失败,退出,代码为1的详细情况,特别关注mongodb连接超时的相关信息。我们将通过专业的研究、有关数据的分析等多种方式,为您呈现一个全面的了解MongoDB:期望:连接失败,退出,代码为1的机会,同时也不会遗漏关于Android Studio“异常:Gradle 任务组装失败,退出代码为 1”、AzerothCore MSB6006“ cmd.exe”退出,代码为1、Chutzpah 4.4.11 在使用 vstest 运行时失败,退出代码为 2、cmd:命令失败,退出代码为ENOENT的知识。
本文目录一览:- MongoDB:期望:连接失败,退出,代码为1(mongodb连接超时)
- Android Studio“异常:Gradle 任务组装失败,退出代码为 1”
- AzerothCore MSB6006“ cmd.exe”退出,代码为1
- Chutzpah 4.4.11 在使用 vstest 运行时失败,退出代码为 2
- cmd:命令失败,退出代码为ENOENT
MongoDB:期望:连接失败,退出,代码为1(mongodb连接超时)
你有你去 /etc ,修改 mongod.conf,因为: “默认情况下,MongoDB 启动时 bindIp 设置为 127.0.0.1,”,它绑定到 localhost 网络接口。这意味着 mongod 只能接受来自运行在同一台机器上的客户端的连接。
然后可以 sudo nano mongod.conf 并将 127.0.0.1 更改为 0.0.0.0
您必须重新启动 mongo。
,mongod必须先运行,然后才能运行mongo而不会出现该错误。
p.s。这是其他人从标题中偶然发现原始问题的答案
,我也遇到了同样的错误,我认为这可能是由于PC上的某些更新(例如.NET框架更新)
然后我再次卸载并重新安装了MongoDB,它可以正常工作
,我昨天遇到了这个问题,我能够通过以下方式解决它:
- 删除 mongod.lock 文件。
- 运行 config fork 命令。
删除 .lock 文件:
sudo rm /usr/local/var/mongodb/mongod.lock
运行:
mongod --config /usr/local/etc/mongod.conf --fork.
并再次使用 mongo 命令。
Android Studio“异常:Gradle 任务组装失败,退出代码为 1”
如何解决Android Studio“异常:Gradle 任务组装失败,退出代码为 1”?
我需要使用 Flutter 来开发一个项目,但我对 Flutter 和 Android Studio 的东西还不熟悉。打开我的虚拟 Android 设备后,我想运行代码来测试它,但我得到了异常:Gradle 任务组装失败,退出代码 1 错误。这是什么原因?当我从 CMD 运行 Flutter doctor 命令时,它没有将 Android Studio 显示为存在,可能是因为这个吗?即便如此,我还是不明白为什么还没有安装 Android Studio。如果您能提供帮助,我会很高兴。
这是我得到的错误:
当我运行 Flutter doctor 命令时,它显示如下:
`C:\Users\USER>Flutter doctor
Doctor summary (to see all details,run Flutter doctor -v):
[√] Flutter (Channel stable,2.2.2,on Microsoft Windows [Version 10.0.19042.1052],locale tr-TR)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[!] Android Studio
X android-studio-dir = /home/piotr/.local/share/JetBrains/ToolBox/apps/AndroidStudio/ch-0/201.6858069
X Android Studio not found at /home/piotr/.local/share/JetBrains/ToolBox/apps/AndroidStudio/ch-0/201.6858069
[√] VS Code (version 1.57.1)
[√] Connected device (3 available)
! Doctor found issues in 1 category.`
解决方法
我通过安装 jdk 解决了这个错误。遇到同样错误的可以安装jdk试试。它很可能会得到解决。
AzerothCore MSB6006“ cmd.exe”退出,代码为1
从外观上看,您已经成功运行了构建,并决定单击Visual Studio上的“播放”按钮。确保您将worlserver作为启动项目。另外,由于需要多个依赖项,因此还要确保Visual Studio具有执行worldserver的正确目录。 您可以在文件所在的bin中寻找它们来手动运行这些文件。您的路径应类似于: c:\ folder_where_azerothcore_project_is \ bin \ Release
在这里,您应该已经正确配置了worldserver.conf和authserver.conf等文件以及数据库数据。您还应该有一些dll:
- libmysql.dll
- libcrypto-1_1-x64
- libssl-1_1-x64
您可以在OpenSSL bin文件夹和Mysql库文件夹中找到它们。
完成所有这些配置后,尝试运行可执行文件,一切顺利!
Chutzpah 4.4.11 在使用 vstest 运行时失败,退出代码为 2
如何解决Chutzpah 4.4.11 在使用 vstest 运行时失败,退出代码为 2?
vstest.console.exe 16.10 适用于 Chutzpah 4.2.3。但是升级到 Chutzpah 4.4.11,它失败了,退出代码为 2。chutzpah.console.exe 也可以在 4.4.11 中自行运行,所以我不确定我是否在 vstest 命令行中遗漏了一些东西。 (从 Azure DevOps 管道运行时,我使用 vstest.console.exe 获得了相同的结果。)
有什么建议吗?
> "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\TestPlatform\vstest.console.exe"
"[path-to-test-file]\index-tests.js"
/TestAdapterPath:"C:\Users\TFSBuild\.nuget\packages\chutzpah\4.4.11\tools"
Microsoft (R) Test Execution Command Line Tool Version 16.10.0
copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution,please wait...
A total of 1 test files matched the specified pattern.
Error: UnkNown error occurred when executing test file. Received exit code of 2
While Running:[path-to-test-file]\index-tests.js
No test is available in [path-to-test-file]\index-tests.js.
Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Test Run Failed.
解决方法
找到了解决方案。我正在使用引擎:Chrome,而较新版本的 Chutzpah 未能找到 chrome.exe。在 Chutzpah.json 中定义 exe 的路径解决了这个问题。
"Engine": "Chrome","EngineOptions": {
"ChromeBrowserPath": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
}
cmd:命令失败,退出代码为ENOENT
嗨,我是一名初学者应用程序开发人员,我选择了phonegap,请在将android作为我的项目平台添加时查看问题。代码如下:
c:\Users\pshewale\Desktop\phone gap\hello>phonegap platform add android
npm
http GET https://registry.npmjs.org/cordova-android
npm http 304 https://registry.npmjs.org/cordova-android
Adding android project...
Error: cmd: Command failed with exit code ENOENT
at ChildProcess.whenDone (C:\Users\pshewale\AppData\Roaming\npm\node_modules
\phonegap\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.j
s:134:23)
at ChildProcess.emit (events.js:107:17)
at Process.ChildProcess._handle.onexit (child_process.js:1072:12)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
更新:谢谢,我认为它向前移动了一点,但现在它显示了这一点:
C:\Users\pshewale\hi>cordova platform add android
npm http GET https://registry.npmjs.org/cordova-android
npm http 200 https://registry.npmjs.org/cordova-android
npm http GET https://registry.npmjs.org/cordova-android
npm http 200 https://registry.npmjs.org/cordova-android
npm http GET https://registry.npmjs.org/cordova-android/-/cordova-android-4.0.2.
tgz
npm http 200 https://registry.npmjs.org/cordova-android/-/cordova-android-4.0.2.
tgz
Adding android project...
Error: cmd: Command failed with exit code ENOENT
at ChildProcess.whenDone (C:\Users\pshewale\AppData\Roaming\npm\node_modules
\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:134:23)
at ChildProcess.emit (events.js:107:17)
at Process.ChildProcess._handle.onexit (child_process.js:1072:12)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
C:\Users\pshewale\hi>
我们今天的关于MongoDB:期望:连接失败,退出,代码为1和mongodb连接超时的分享就到这里,谢谢您的阅读,如果想了解更多关于Android Studio“异常:Gradle 任务组装失败,退出代码为 1”、AzerothCore MSB6006“ cmd.exe”退出,代码为1、Chutzpah 4.4.11 在使用 vstest 运行时失败,退出代码为 2、cmd:命令失败,退出代码为ENOENT的相关信息,可以在本站进行搜索。
如果您对我正在使用Oauth进行Google身份验证并获取client-id和client_secret,但是显示未定义感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解我正在使用Oauth进行Google身份验证并获取client-id和client_secret,但是显示未定义的各种细节,此外还有关于android – 在使用Firebase身份验证进行身份验证后检索Google Access令牌、android – 如何使用ClientID和ClientSecret在Phonegap中使用Angularjs登录Google OAuth2、android – 新发布的“使用Google Play服务进行身份验证”,通过GoogleAuthUtil.getToken获取令牌的问题、ASP.NET OAuth授权 – 使用ClientId和Secret以及用户名和密码之间的区别的实用技巧。
本文目录一览:- 我正在使用Oauth进行Google身份验证并获取client-id和client_secret,但是显示未定义
- android – 在使用Firebase身份验证进行身份验证后检索Google Access令牌
- android – 如何使用ClientID和ClientSecret在Phonegap中使用Angularjs登录Google OAuth2
- android – 新发布的“使用Google Play服务进行身份验证”,通过GoogleAuthUtil.getToken获取令牌的问题
- ASP.NET OAuth授权 – 使用ClientId和Secret以及用户名和密码之间的区别
我正在使用Oauth进行Google身份验证并获取client-id和client_secret,但是显示未定义
如何解决我正在使用Oauth进行Google身份验证并获取client-id和client_secret,但是显示未定义?
在超级中,它显示错误,有人正在使用node.js来帮助解决此类型错误:
$ nodemon app.js
[nodemon] 2.0.4
[nodemon]随时重新启动,请输入rs
[nodemon]观看路径:。
[nodemon]看扩展:js,mjs,json
[nodemon]开始node app.js
未定义
undefinedC:\ Users \ sunny \ desktop \ secretsstartingcode \ node_modules \ passport-oauth2 \ lib \ strategy.js:86
如果(!options.clientID){抛出新的TypeError(''OAuth2Strategy需要一个clientID选项''); }
^
TypeError:OAuth2Strategy在Strategy.OAuth2Strategy需要一个clientID选项(C:\ Users \ sunny \ desktop \ secretsstartingcode \ node_modules \ passport-oauth2 \ lib \ strategy.js:86:34)
在新策略下(C:\ Users \ sunny \ desktop \ secretsstartingcode \ node_modules \ passport-google-oauth20 \ lib \ strategy.js:52:18)
在对象。 (C:\ Users \ sunny \ desktop \ secretsstartingcode \ app.js:70:15)
在Module._compile(内部/模块/cjs/loader.js:1137:30)
在Object.Module._extensions..js(内部/模块/cjs/loader.js:1157:10)
在Module.load(internal / modules / cjs / loader.js:985:32)
在Function.Module._load(内部/模块/cjs/loader.js:878:14)
在Function.executeUserEntryPoint [作为runMain](内部/模块/run_main.js:71:12)
在internal / main / run_main_module.js:17:47
[nodemon]应用程序崩溃-等待文件更改,然后再开始...
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
android – 在使用Firebase身份验证进行身份验证后检索Google Access令牌
我已经在Firebase-UI for Android – Auth图书馆的帮助下,在我的应用程序中成功集成了Google登录.从FirebaseUser.getToken()方法检索的令牌不是REST API的有效Google访问令牌.
user.getToken(true).addOnCompleteListener(new OnCompleteListener<GetTokenResult>() { public void onComplete(@NonNull Task<GetTokenResult> task) { if (task.isSuccessful()) { String token = task.getResult().getToken(); // 'token' is not a Google Access Token } } });
在Google Sign-In for Web guide,可以通过调用var token = result.credential.accesstoken获取访问令牌;但是我在Android中找不到类似的方法.
任何投入?如果我没有提供足够的信息,请给我留言.谢谢 :)
解决方法
你会遇到三种类型的令牌,你会遇到火墙:
> Firebase ID令牌
当用户登录到Firebase应用程序时,由Firebase创建.这些令牌是签名的JWT,可以安全地识别Firebase项目中的用户.这些令牌包含用户的基本配置文件信息,包括用户的ID字符串,这是Firebase项目唯一的.由于可以验证ID令牌的完整性,因此可以将其发送到后端服务器,以识别当前登录的用户.
>身份提供者令牌
由联合身份提供商(如Google和Facebook)创建.这些令牌可以有不同的格式,但通常是OAuth 2.0访问令牌. Firebase应用程序使用这些令牌来验证用户已经使用身份提供程序成功进行身份验证,然后将其转换为Firebase服务可用的凭据.
> Firebase自定义令牌
由您的自定义验证系统创建,以允许用户使用您的验证系统登录Firebase应用.自定义令牌是使用服务帐户的私钥签名的JWT. Firebase应用程序使用这些令牌非常像使用从联合身份提供者返回的令牌.
现在,你得到的是Firebase Id令牌,你需要的是Identity Provider Token.
获取身份提供者令牌很简单,它只是您显示步骤之前的一步.
所以,我们使用firebase登录google的方式是here.
我将在下面添加完整的代码,在UI中显示一个按钮,点击后,将登录用户到谷歌帐户.然后我会得到google访问令牌,然后将其发送到firebase,在那里将其转换为firebase token Id.
我假设你已经配置Android应用程序进行谷歌登录,如果没有,你可以详细介绍here.
(为了简化,只要看下面的步骤5,如果你已经完成了设置.)
代码:
>配置Google SignIn和Googleapiclient:
// Configure sign-in to request the user's ID,email address,and basic // profile. ID and basic profile are included in DEFAULT_SIGN_IN. GoogleSignInoptions gso = new GoogleSignInoptions.Builder(GoogleSignInoptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestemail() .build(); // NOTE : // The string passed to requestIdToken,default_web_client_id,// can be obtained from credentials page (https://console.developers.google.com/apis/credentials). // There mentioned Web application type client ID is this string. // ... // Build a Googleapiclient with access to the Google Sign-In API and the // options specified by gso. mGoogleapiclient = new Googleapiclient.Builder(this) .enableAutoManage(this /* Activity */,this /* OnConnectionFailedListener */) .addApi(Auth.GOOGLE_SIGN_IN_API,gso) .build();
>将Google登录按钮添加到您的应用程序
<com.google.android.gms.common.SignInButton android:id="@+id/sign_in_button" android:layout_width="wrap_content" android:layout_height="wrap_content" />
>设置SignIn Click Listener
findViewById(R.id.sign_in_button).setonClickListener(new OnClickListener() { public void onClick(View v){ Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleapiclient); startActivityForResult(signInIntent,RC_SIGN_IN); } });
>覆盖活动中的OnActivityResult方法:
@Override public void onActivityResult(int requestCode,int resultCode,Intent data) { super.onActivityResult(requestCode,resultCode,data); // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...); if (requestCode == RC_SIGN_IN) { // Google Sign In was successful,authenticate with Firebase GoogleSignInAccount account = result.getSignInAccount(); firebaseAuthWithGoogle(account); // This method is implemented in step 5. } else { // Google Sign In Failed,update UI appropriately // ... } }
>使用Google SignInAccount进行Firebase验证
String idTokenString = ""; ... private void firebaseAuthWithGoogle(GoogleSignInAccount acct) { Log.d(TAG,"Google User Id :" + acct.getId()); // --------------------------------- // // BELOW LINE GIVES YOU JSON WEB TOKEN,(USED TO GET ACCESS TOKEN) : Log.d(TAG,"Google JWT : " + acct.getIdToken()); // --------------------------------- // // Save this JWT in global String : idTokenString = acct.getIdToken(); AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(),null); mAuth.signInWithCredential(credential) .addOnCompleteListener(this,new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { Log.d(TAG,"signInWithCredential:onComplete:" + task.isSuccessful()); if(task.isSuccessful()){ // --------------------------------- // // BELOW LINE GIVES YOU FIREBASE TOKEN ID : Log.d(TAG,"Firebase User Access Token : " + task.getResult().getToken()); // --------------------------------- // } // If sign in fails,display a message to the user. If sign in succeeds // the auth state listener will be notified and logic to handle the // signed in user can be handled in the listener. else { Log.w(TAG,"signInWithCredential",task.getException()); Toast.makeText(GoogleSignInActivity.this,"Authentication Failed.",Toast.LENGTH_SHORT).show(); } } }); }
>最后一步:Firebase的认证听众
private FirebaseAuth mAuth; private FirebaseAuth.AuthStateListener mAuthListener; @Override protected void onCreate(Bundle savedInstanceState) { // ... mAuth = FirebaseAuth.getInstance(); mAuthListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { FirebaseUser user = firebaseAuth.getCurrentUser(); if (user != null) { // User is signed in Log.d(TAG,"onAuthStateChanged:signed_in:" + user.getUid()); } else { // User is signed out Log.d(TAG,"onAuthStateChanged:signed_out"); } // ... } }; // ... } //... @Override public void onStart() { super.onStart(); mAuth.addAuthStateListener(mAuthListener); } @Override public void onStop() { super.onStop(); if (mAuthListener != null) { mAuth.removeAuthStateListener(mAuthListener); } }
所以,你的答案在于第5步,这是在您验证firebase之前,并在您的身份验证后,谷歌登录.
希望有帮助!
更新:
重要的是,在步骤1中,您请求令牌ID,否则在步骤5中,您将获得空标记ID.有关更多信息,请参阅here.我已更新步骤1.
更新:
根据讨论,检索的令牌是写入here的JWT令牌.我们需要的是谷歌访问令牌.以下代码使用JWT令牌在OAuth后端启动并检索此访问令牌:
(注:我已经使用okhttp版本2.6.0,其他版本可能有不同的方法)
代码:
... OkHttpClient client = new OkHttpClient(); RequestBody requestBody = new FormEncodingBuilder() .add("grant_type","authorization_code") .add("client_id","<Your-client-id>") // something like : ...apps.googleusercontent.com .add("client_secret","{Your-client-secret}") .add("redirect_uri","") .add("code","4/4-GMMhmHCXhWEzkobqIHGG_EnNYYsAkukHspeYUk9E8") // device code. .add("id_token",idTokenString) // This is what we received in Step 5,the jwt token. .build(); final Request request = new Request.Builder() .url("https://www.googleapis.com/oauth2/v4/token") .post(requestBody) .build(); client.newCall(request).enqueue(new Callback() { @Override public void onFailure(final Request request,final IOException e) { Log.e(LOG_TAG,e.toString()); } @Override public void onResponse(Response response) throws IOException { try { JSONObject jsonObject = new JSONObject(response.body().string()); final String message = jsonObject.toString(5); Log.i(LOG_TAG,message); } catch (JSONException e) { e.printstacktrace(); } } });
这是根据需要具有访问令牌的输出:
I/OnResponse: { "expires_in": 3600,"token_type": "Bearer","refresh_token": "1\/xz1eb0XU3....nxoALEVQ","id_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjQxMWY1Ym......yWVsUA","access_token": "ya29.bQKKYah-........_tkt980_qAGIo9yeWEG4" }
希望现在有帮助!
android – 如何使用ClientID和ClientSecret在Phonegap中使用Angularjs登录Google OAuth2
如果没有任何正确的答案,这个问题似乎正在蔓延.我希望现在应该解决. Google Angular Guys应该会有所帮助.
How to implement Google Auth in phonegap?
最接近的主题是How to use Google Login API with Cordova/Phonegap,但这不是angularjs的解决方案.
我不得不使用以下代码传输javascript变量值:
var el = document.getElementById('test'); var scopeTest = angular.element(el).scope(); scopeTest.$apply(function(){ scopeTest.user = user; scopeTest.logged_in = true; scopeTest.name = user.name; scopeTest.email = user.email; });
解决方法
.controller('TestCtrl',function($scope,$ionicPopup) { $scope.logged_in = false; $scope.getMember = function(id) { console.log(id); }; $scope.test = function(){ $ionicPopup.alert({"title":"Clicked"}); } $scope.call_google = function(){ googleapi.authorize({ client_id: 'CLIENT_ID',client_secret: 'CLIENT_SECRET',redirect_uri: 'http://localhost',scope: 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email' }).done(function(data) { accesstoken=data.access_token; // alert(accesstoken); // $loginStatus.html('Access Token: ' + data.access_token); console.log(data.access_token); //$ionicPopup.alert({"title":JSON.stringify(data)}); $scope.getDataProfile(); }); }; $scope.getDataProfile = function(){ var term=null; // alert("getting user data="+accesstoken); $.ajax({ url:'https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token='+accesstoken,type:'GET',data:term,dataType:'json',error:function(jqXHR,text_status,strError){ },success:function(data) { var item; console.log(JSON.stringify(data)); // Save the userprofile data in your localStorage. window.localStorage.gmailLogin="true"; window.localStorage.gmailID=data.id; window.localStorage.gmailEmail=data.email; window.localStorage.gmailFirstName=data.given_name; window.localStorage.gmailLastName=data.family_name; window.localStorage.gmailProfilePicture=data.picture; window.localStorage.gmailGender=data.gender; window.localStorage.gmailName=data.name; $scope.email = data.email; $scope.name = data.name; } }); //$scope.disconnectUser(); //This call can be done later. }; $scope.disconnectUser = function() { var revokeUrl = 'https://accounts.google.com/o/oauth2/revoke?token='+accesstoken; // Perform an asynchronous GET request. $.ajax({ type: 'GET',url: revokeUrl,async: false,contentType: "application/json",dataType: 'jsonp',success: function(nullResponse) { // Do something Now that user is disconnected // The response is always undefined. accesstoken=null; console.log(JSON.stringify(nullResponse)); console.log("-----signed out..!!----"+accesstoken); },error: function(e) { // Handle the error // console.log(e); // You Could point users to manually disconnect if unsuccessful // https://plus.google.com/apps } }); }; })
我正在为尝试使用Google OAuth2登录时面临类似问题的新手提供此答案.因此,我无耻地要求UpVotes,因为我也是新来的!
android – 新发布的“使用Google Play服务进行身份验证”,通过GoogleAuthUtil.getToken获取令牌的问题
刚刚通过我也用于Google App Engine的Google帐户注册了Google Api,现在错误已更改为com.google.android.gms.auth.GoogleAuthException:未知
谷歌刚刚发布了一个新的方式到sign up to one’s app via a Google Account,并在他们的blogpost也给了一些解释.
我正在编写一个Android应用程序,您必须注册才能创建一个用户帐户,并且我在后端使用Google App Engine.通过播放服务,我想让用户的电子邮件附属于他们的Android设备和令牌.我可以收到电子邮件,但是,获取令牌只会引发错误,由于文档相当稀疏,我不知道如何解决这些错误.这就是我收到的电子邮件:
private String[] getAccountNames() { mAccountManager = AccountManager.get(this); Account[] accounts = mAccountManager.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE); names = new String[accounts.length]; for (int i = 0; i < names.length; i++) { names[i] = accounts[i].name; } return names; }
但是,当我打电话给token = GoogleAuthUtil.getToken(上下文,电子邮件,
“范围”,它给我这些错误:
由于错误1和com.google.android.gms.auth.GooglePlayServicesAvailabilityException:GooglePlayServicesNotAvailable,GooglePlayServices不可用.
现在我的问题是,我必须设置任何权限或包含任何库来解决这个问题吗?什么是范围参数?在他们的博客文章中给出了如何获取令牌和放置在范围内的示例,将范围变量设置为“https://www.googleapis.com/auth/userinfo.profile”,但是我仍然收到相同的错误不幸.
我还注册了我的Google Api控制台应用程序并启用了G API,是否还必须配置其他的东西?
解决方法
解决方案很简单.只需将“oauth2:”添加到您的scopeUrl.
错误:
GoogleAuthUtil.getToken(this,account.name,DriveScopes.DRIVE);
对:
GoogleAuthUtil.getToken(this,"oauth2:" + DriveScopes.DRIVE);
ASP.NET OAuth授权 – 使用ClientId和Secret以及用户名和密码之间的区别
以下是我设置AuthorizationServer的方法:
app.USEOAuthAuthorizationServer(new OAuthAuthorizationServerOptions() { AllowInsecureHttp = true,TokenEndpointPath = new PathString("/token"),AccesstokenExpireTimeSpan = TimeSpan.FromMinutes(5),Provider = new SimpleAuthorizationServerProvider(new SimpleAuthorizationServerProviderOptions() { ValidateUserCredentialsFunction = ValidateUser }),RefreshTokenProvider = new SimpleRefreshTokenProvider() });
这是我的SimpleAuthorizationServerProviderOptions实现:
public class SimpleAuthorizationServerProvider : OAuthAuthorizationServerProvider { public delegate Task<bool> ClientCredentialsValidationFunction(string clientid,string secret); public delegate Task<IEnumerable<Claim>> UserCredentialValidationFunction(string username,string password); public SimpleAuthorizationServerProviderOptions Options { get; private set; } public SimpleAuthorizationServerProvider(SimpleAuthorizationServerProviderOptions options) { if (options.ValidateUserCredentialsFunction == null) { throw new NullReferenceException("ValidateUserCredentialsFunction cannot be null"); } Options = options; } public SimpleAuthorizationServerProvider(UserCredentialValidationFunction userCredentialValidationFunction) { Options = new SimpleAuthorizationServerProviderOptions() { ValidateUserCredentialsFunction = userCredentialValidationFunction }; } public SimpleAuthorizationServerProvider(UserCredentialValidationFunction userCredentialValidationFunction,ClientCredentialsValidationFunction clientCredentialsValidationFunction) { Options = new SimpleAuthorizationServerProviderOptions() { ValidateUserCredentialsFunction = userCredentialValidationFunction,ValidateClientCredentialsFunction = clientCredentialsValidationFunction }; } public override async Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context) { if (Options.ValidateClientCredentialsFunction != null) { string clientId,clientSecret; if (!context.TryGetBasicCredentials(out clientId,out clientSecret)) { context.TryGetFormCredentials(out clientId,out clientSecret); } var clientValidated = await Options.ValidateClientCredentialsFunction(clientId,clientSecret); if (!clientValidated) { context.Rejected(); return; } } context.Validated(); } public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context) { if (Options.ValidateUserCredentialsFunction == null) { throw new NullReferenceException("ValidateUserCredentialsFunction cannot be null"); } var claims = await Options.ValidateUserCredentialsFunction(context.UserName,context.Password); if (claims == null) { context.Rejected(); return; } // create identity var identity = new ClaimsIdentity(claims,context.Options.AuthenticationType); // create Metadata to pass to refresh token provider var props = new AuthenticationProperties(new Dictionary<string,string>() { { "as:client_id",context.UserName } }); var ticket = new AuthenticationTicket(identity,props); context.Validated(ticket); } public override async Task GrantRefreshToken(OAuthGrantRefreshTokenContext context) { var originalClient = context.Ticket.Properties.Dictionary["as:client_id"]; var currentClient = context.ClientId; // enforce client binding of refresh token if (originalClient != currentClient) { context.Rejected(); return; } // chance to change authentication ticket for refresh token requests var newIdentity = new ClaimsIdentity(context.Ticket.Identity); newIdentity.AddClaim(new Claim("newClaim","refreshToken")); var newTicket = new AuthenticationTicket(newIdentity,context.Ticket.Properties); context.Validated(newTicket); } }
我的SimpleRefreshTokenProvider实现:
public class SimpleRefreshTokenProvider : IAuthenticationTokenProvider { private static ConcurrentDictionary<string,AuthenticationTicket> _refreshTokens = new ConcurrentDictionary<string,AuthenticationTicket>(); public void Create(AuthenticationTokenCreateContext context) { } public async Task CreateAsync(AuthenticationTokenCreateContext context) { var guid = Guid.NewGuid().ToString(); var refreshTokenProperties = new AuthenticationProperties(context.Ticket.Properties.Dictionary) { IssuedUtc = context.Ticket.Properties.IssuedUtc,ExpiresUtc = DateTime.UtcNow.AddYears(1) }; var refreshTokenTicket = new AuthenticationTicket(context.Ticket.Identity,refreshTokenProperties); _refreshTokens.TryAdd(guid,refreshTokenTicket); context.SetToken(guid); } public void Receive(AuthenticationTokenReceiveContext context) { } public async Task ReceiveAsync(AuthenticationTokenReceiveContext context) { AuthenticationTicket ticket; if (_refreshTokens.TryRemove(context.Token,out ticket)) { context.SetTicket(ticket); } } }
我不完全理解的是使用ClientId和Secret vs用户名和密码.我粘贴的代码通过用户名和密码生成令牌,我可以使用该令牌(直到它过期),但是当我尝试获取刷新令牌时,我必须拥有ClientId.
此外,如果令牌过期,正确的方法是发送刷新令牌并获取新令牌?如果刷新令牌被盗怎么办?是不是用户名和&密码被盗?
解决方法
What I don’t fully understand is the use of
ClientId and Secret
vsUsername and Password
. The code I pasted generates a token by username and password and I can work with that token (until it expires),but when I try to get a refresh token,I must have the ClientId.Also,if a token expires,the correct way is to send the refresh token and get a new token? What if the refresh token gets stolen? isn’t it the same as a username & password getting stolen?
在OAuth2中,必须在协议定义的任何授权流中对用户和客户端进行身份验证.客户端身份验证(您可能猜到)仅强制使用您的API,只有已知客户端才能使用.序列化访问令牌一旦生成,就不会直接绑定到特定客户端.请注意,ClientSecret必须被视为机密信息,并且只能由能够以某种安全方式存储此信息的客户端使用(例如,外部服务客户端,而不是javascript客户端).
刷新令牌只是OAuth2的替代“授权类型”,并且正如您所说的那样,将替换用户的用户名和密码对.此令牌必须被视为机密数据(甚至比访问令牌更加机密),但优于存储用户名和密码.客户端密码:
>如果受到损害,用户可以撤销;
>它的寿命有限(通常是几天或几周);
>它不会公开用户凭据(攻击者只能获取发布刷新令牌的“范围”的访问令牌).
我建议您阅读有关official draft中OAuth 2检查中定义的不同授权类型的更多信息.我还建议您this resource我发现在Web API中首次实现OAuth2时非常有用.
样品申请
以下是使用fiddler的两个请求示例,用于资源所有者密码凭据授予:
和刷新令牌授予:
我们今天的关于我正在使用Oauth进行Google身份验证并获取client-id和client_secret,但是显示未定义的分享就到这里,谢谢您的阅读,如果想了解更多关于android – 在使用Firebase身份验证进行身份验证后检索Google Access令牌、android – 如何使用ClientID和ClientSecret在Phonegap中使用Angularjs登录Google OAuth2、android – 新发布的“使用Google Play服务进行身份验证”,通过GoogleAuthUtil.getToken获取令牌的问题、ASP.NET OAuth授权 – 使用ClientId和Secret以及用户名和密码之间的区别的相关信息,可以在本站进行搜索。
如果您想了解为什么mongoimport.exe从我的程序包中消失了?和mongoimport 没找到的知识,那么本篇文章将是您的不二之选。我们将深入剖析为什么mongoimport.exe从我的程序包中消失了?的各个方面,并为您解答mongoimport 没找到的疑在这篇文章中,我们将为您介绍为什么mongoimport.exe从我的程序包中消失了?的相关知识,同时也会详细的解释mongoimport 没找到的运用方法,并给出实际的案例分析,希望能帮助到您!
本文目录一览:- 为什么mongoimport.exe从我的程序包中消失了?(mongoimport 没找到)
- "from pymongo import Connection" (to import mongo.connection using python) , got "500 Internal Server Error"
- 2,使用mongoimport批量导入数据
- android-为什么imageview在布局上消失了?
- ios – 为什么我的Xcode 6.1.1模拟器选项都消失了?
为什么mongoimport.exe从我的程序包中消失了?(mongoimport 没找到)
我遇到了同样的问题。请查找以下信息可能会帮助您解决与 mongoimport 相关的问题。
从 MongoDB 4.4 服务器版本开始,数据库工具现在单独进行版本控制和安装。这些工具独立于 MongoDB 服务器计划发布,使您能够接收更频繁的更新并在新功能可用时立即利用它们。其中包括:mongodump、mongorestore、mongoimport 和 mongoexport。
This is the download link for MongoDB Database Tools
,我自己也遇到了同样的问题。从MongoDB 4.4开始,数据库工具现在是Linux以外所有平台的单独安装。您可以找到针对平台here安装的说明。
"from pymongo import Connection" (to import mongo.connection using python) , got "500 Internal Server Error"
I created the /var/www/cgi-bin/test.py in my web server machine (Linux). The service of mongoDB "mongod" is running.
When I run the test.py locally, "./test.py", I could get the correct result.
But when I use the URL: http://xxxxxx.compute-1.amazonaws.com/cgi-bin/python_test/test.py to run the test.py, I will get the "500 Internal Server Error".
If I remove the line "from pymongo import Connection", and use the URL above to access, I won''t get the 500 Internal server error. So, it should be the problem when I import the pymongo.connection.
Is it the problem of any configuration issue? Thanks so much for your help
========== test.py ==============
#!/usr/bin/python
import cgi
import sys
sys.path.append("/home/ec2-user/mongo-python-driver-2.6.3/")
#import pymongo.connection
from pymongo import Connection
def main():
print "Content-type: text/html\r\n\r\n"
form = cgi.FieldStorage()
name = form.getvalue(''ServiceCode'')
# name = "abcddd"
# con = Connection()
# db = con.test
# posts = db.post
# print name
if form.has_key("ServiceCode") and form["ServiceCode"].value!="":
print"<h1>Hello", form["ServiceCode"].value,"</h1>"
else:
print"<h1>Error! Please enter first name. </h1>"
.....
2,使用mongoimport批量导入数据
1,下载MongoDB数据库工具
https://www.mongodb.com/try/download/database-tools
注意:
从MongoDB 4.4开始,MongoDB数据库工具单独发布,使用自己的版本,初始版本为100.0.0
目前最新的版本为100.3.1,其支持如下版本:
MongoDB 5.0
MongoDB 4.4
MongoDB 4.2
MongoDB 4.0
MongoDB 3.6
2,安装
1,可以下载.msi或zip包
2,如果是zip,需要解压到某个目录,并将其配置到系统环境变量里面
3,启动mongo服务
mongod.exe --dbpath D:\UserData\mongodb --auth
4,批量导入数据
cd D:\DevelopmentTool\mongodb-win32-x86_64-windows-5.0.0\tool
mongoimport --db test --collection book --authenticationDatabase admin --username admin --password 123456 --drop --file D:\UserData\Administrator\Desktop\book.crud.json
说明:
--db test 将数据存入test库
--collection book 将数据存入book集合
--authenticationDatabase admin --username admin --password 123456 使用admin和123456进行登录
--drop 如果集合存在,就删除
--file D:\UserData\Administrator\Desktop\book.crud.json 指定导入的数据文件
文件book.crud.json内容:
{ "item": "journal", "qty": 25, "size": { "h": 14, "w": 21, "uom": "cm" }, "status": "A" }
{ "item": "notebook", "qty": 50, "size": { "h": 8.5, "w": 11, "uom": "in" }, "status": "A" }
{ "item": "paper", "qty": 100, "size": { "h": 8.5, "w": 11, "uom": "in" }, "status": "D" }
{ "item": "planner", "qty": 75, "size": { "h": 22.85, "w": 30, "uom": "cm" }, "status": "D" }
{ "item": "postcard", "qty": 45, "size": { "h": 10, "w": 15.25, "uom": "cm" }, "status": "A" }
# 输出
2021-07-15T09:17:12.084+0800 connected to: mongodb://localhost/
2021-07-15T09:17:12.160+0800 dropping: test.book
2021-07-15T09:17:12.641+0800 5 document(s) imported successfully. 0 document(s) failed to import.
# 查询所有数据
# 连接服务端
..\bin\mongo.exe mongodb://admin:123456@127.0.0.1:27017/admin
# 切换数据库
use test;
# 查询所有数据
books = db.book.find({});
android-为什么imageview在布局上消失了?
imageview在布局的右侧.如果messagedetail_row_text的内容太长,则不会显示.如果messagedetail_row_text的内容不太长,则会显示imageview.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="right"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/dfdwasdfds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/outgoing"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="22dip"
android:orientation="horizontal" >
<TextView
android:id="@+id/messagedetail_row_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="1dp"
android:textColor="#000000"
android:textSize="18sp" />
<TextView
android:id="@+id/messagedetail_row_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dip"
android:paddingTop="1dp"
android:textColor="#000000"
android:textSize="16sp" />
</LinearLayout>
<TextView
android:id="@+id/messagedetail_row_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="2dp"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toRightOf="@id/dfdwasdfds"
>
<ImageView
android:id="@+id/messagegedetail_rov_icon2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:gravity="right"
android:src="@drawable/retouxiang" />
</LinearLayout>
</RelativeLayout>
解决方法:
不清楚您要寻找的是什么.据我了解:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="right"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/xyz"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<ImageView
android:id="@+id/messagegedetail_rov_icon2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:gravity="right"
android:src="@drawable/retouxiang" />
</LinearLayout>
<LinearLayout
android:id="@+id/dfdwasdfds"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/xyz"
android:background="@drawable/outgoing"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="22dip"
android:orientation="horizontal" >
<TextView
android:id="@+id/messagedetail_row_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="1dp"
android:textColor="#000000"
android:text="messagedetail_row_name"
android:textSize="18sp" />
<TextView
android:id="@+id/messagedetail_row_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dip"
android:paddingTop="1dp"
android:text="messagedetail_row_date"
android:textColor="#000000"
android:textSize="16sp" />
</LinearLayout>
<TextView
android:id="@+id/messagedetail_row_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="2dp"
android:text="messagedetail_row_text and this is a long text"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
</RelativeLayout>
ios – 为什么我的Xcode 6.1.1模拟器选项都消失了?
在我重新安装Xcode之前,Xcode提供的唯一选择是在iOS设备上运行应用程序,但我没有准备在客户面前执行此操作,而无需先在模拟器上测试修订版本.
值得庆幸的是,在我离开家之前,我能够演示我在iPhone 4和iPhone 5 C上安装的早期版本.但是,在我下次出国访问期间,了解我可以做些什么来避免这种情况真的很好.
我怀疑这个问题可能是由我国内外的互联网连接之间的差异引起的.
有没有其他人遇到过可能相关的类似问题?
解决方法
窗口>设备
您将看到没有设备显示请执行以下操作左下方点击然后开始添加您的设备.
今天关于为什么mongoimport.exe从我的程序包中消失了?和mongoimport 没找到的介绍到此结束,谢谢您的阅读,有关"from pymongo import Connection" (to import mongo.connection using python) , got "500 Internal Server Error"、2,使用mongoimport批量导入数据、android-为什么imageview在布局上消失了?、ios – 为什么我的Xcode 6.1.1模拟器选项都消失了?等更多相关知识的信息可以在本站进行查询。
在本文中,我们将给您介绍关于如何编辑Prestashop后台客户获取数据的详细内容,并且为您解答prestashop教程的相关问题,此外,我们还将为您提供关于ecshop后台登录后出现了xmlHttpRequest status:[500] Unknow status.这个是什么错误啊!、ecshop后台编辑器替换成ueditor编辑器、ecshop后台编辑器替换成ueditor编辑器_PHP、ecshop后台编辑器替换成ueditor编辑器_php实例的知识。
本文目录一览:- 如何编辑Prestashop后台客户获取数据(prestashop教程)
- ecshop后台登录后出现了xmlHttpRequest status:[500] Unknow status.这个是什么错误啊!
- ecshop后台编辑器替换成ueditor编辑器
- ecshop后台编辑器替换成ueditor编辑器_PHP
- ecshop后台编辑器替换成ueditor编辑器_php实例
如何编辑Prestashop后台客户获取数据(prestashop教程)
如何解决如何编辑Prestashop后台客户获取数据?
我已经创建了一个用户级别“卖方”,我希望这种类型的每个用户只能看到分配给他的订单和客户。我在ps_customer表中添加了一个列,以将客户与卖方相关联。对于我已成功完成的订单(用户以卖方身份登录,他只看到分配给他的客户的订单),而在后台中找不到管理“客户”部分的控制器。
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
ecshop后台登录后出现了xmlHttpRequest status:[500] Unknow status.这个是什么错误啊!
ecshop后台登录后出现了xmlHttpRequest status:[500] Unknow status.这个是什么错误啊!求解决 !!!ecshop后台编辑器替换成ueditor编辑器
1、Ueditor1.4.3下载
(截止到2015-03-03最新版)下载地址: 解决jquery冲突的jquery等相关文件下载 文件中已含js冲突修改文件,另外已修改php/config.json中的图处保存路径,用户也可以自行修改! 因为老杨用的是mac os系统,所以文件中有一些.DS_store文件,可以忽略或自行删除 下载地址: 密码:fflu (老杨提供)
2、上传到网站服务器
解压并上传目录 uediter 到根目录 /includes 下 解压老杨的那个东东,把fix_jquery上传到 ueditor 的目录下
3、修改/admin/includes/lib_main.PHP
找到下面的函数
$editor->BasePath = '../includes/fckeditor/';
$editor->ToolbarSet = 'normal';
$editor->Width = '100%';
$editor->Height = '320';
$editor->Value = $input_value;
$FCKeditor = $editor->CreateHtml();
$smarty->assign('FCKeditor',$FCKeditor);
}
替换为: